clang 12.0.1
Sema.h
Go to the documentation of this file.
1//===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the Sema class, which performs semantic analysis and
10// builds ASTs.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SEMA_SEMA_H
15#define LLVM_CLANG_SEMA_SEMA_H
16
18#include "clang/AST/ASTFwd.h"
19#include "clang/AST/Attr.h"
24#include "clang/AST/Expr.h"
25#include "clang/AST/ExprCXX.h"
27#include "clang/AST/ExprObjC.h"
32#include "clang/AST/NSAPI.h"
34#include "clang/AST/StmtCXX.h"
35#include "clang/AST/TypeLoc.h"
39#include "clang/Basic/Module.h"
48#include "clang/Sema/DeclSpec.h"
53#include "clang/Sema/Scope.h"
56#include "clang/Sema/Weak.h"
57#include "llvm/ADT/ArrayRef.h"
58#include "llvm/ADT/Optional.h"
59#include "llvm/ADT/SetVector.h"
60#include "llvm/ADT/SmallBitVector.h"
61#include "llvm/ADT/SmallPtrSet.h"
62#include "llvm/ADT/SmallSet.h"
63#include "llvm/ADT/SmallVector.h"
64#include "llvm/ADT/TinyPtrVector.h"
65#include "llvm/Frontend/OpenMP/OMPConstants.h"
66#include <deque>
67#include <memory>
68#include <string>
69#include <tuple>
70#include <vector>
71
72namespace llvm {
73 class APSInt;
74 template <typename ValueT> struct DenseMapInfo;
75 template <typename ValueT, typename ValueInfoT> class DenseSet;
76 class SmallBitVector;
77 struct InlineAsmIdentifierInfo;
78}
79
80namespace clang {
81 class ADLResult;
82 class ASTConsumer;
83 class ASTContext;
84 class ASTMutationListener;
85 class ASTReader;
86 class ASTWriter;
87 class ArrayType;
88 class ParsedAttr;
89 class BindingDecl;
90 class BlockDecl;
91 class CapturedDecl;
92 class CXXBasePath;
93 class CXXBasePaths;
94 class CXXBindTemporaryExpr;
96 class CXXConstructorDecl;
97 class CXXConversionDecl;
98 class CXXDeleteExpr;
99 class CXXDestructorDecl;
100 class CXXFieldCollector;
101 class CXXMemberCallExpr;
102 class CXXMethodDecl;
103 class CXXScopeSpec;
104 class CXXTemporary;
105 class CXXTryStmt;
106 class CallExpr;
107 class ClassTemplateDecl;
108 class ClassTemplatePartialSpecializationDecl;
109 class ClassTemplateSpecializationDecl;
110 class VarTemplatePartialSpecializationDecl;
111 class CodeCompleteConsumer;
112 class CodeCompletionAllocator;
113 class CodeCompletionTUInfo;
114 class CodeCompletionResult;
115 class CoroutineBodyStmt;
116 class Decl;
117 class DeclAccessPair;
118 class DeclContext;
119 class DeclRefExpr;
120 class DeclaratorDecl;
121 class DeducedTemplateArgument;
122 class DependentDiagnostic;
123 class DesignatedInitExpr;
124 class Designation;
125 class EnableIfAttr;
126 class EnumConstantDecl;
127 class Expr;
128 class ExtVectorType;
129 class FormatAttr;
130 class FriendDecl;
131 class FunctionDecl;
132 class FunctionProtoType;
133 class FunctionTemplateDecl;
134 class ImplicitConversionSequence;
136 class InitListExpr;
137 class InitializationKind;
138 class InitializationSequence;
139 class InitializedEntity;
140 class IntegerLiteral;
141 class LabelStmt;
142 class LambdaExpr;
143 class LangOptions;
144 class LocalInstantiationScope;
145 class LookupResult;
146 class MacroInfo;
148 class ModuleLoader;
149 class MultiLevelTemplateArgumentList;
150 class NamedDecl;
151 class ObjCCategoryDecl;
152 class ObjCCategoryImplDecl;
153 class ObjCCompatibleAliasDecl;
154 class ObjCContainerDecl;
155 class ObjCImplDecl;
156 class ObjCImplementationDecl;
157 class ObjCInterfaceDecl;
158 class ObjCIvarDecl;
159 template <class T> class ObjCList;
160 class ObjCMessageExpr;
161 class ObjCMethodDecl;
162 class ObjCPropertyDecl;
163 class ObjCProtocolDecl;
165 class OMPRequiresDecl;
167 class OMPDeclareSimdDecl;
168 class OMPClause;
169 struct OMPVarListLocTy;
170 struct OverloadCandidate;
171 enum class OverloadCandidateParamOrder : char;
174 class OverloadExpr;
175 class ParenListExpr;
176 class ParmVarDecl;
177 class Preprocessor;
179 class PseudoObjectExpr;
180 class QualType;
182 class Stmt;
183 class StringLiteral;
184 class SwitchStmt;
185 class TemplateArgument;
188 class TemplateDecl;
193 class Token;
194 class TypeAliasDecl;
195 class TypedefDecl;
196 class TypedefNameDecl;
197 class TypeLoc;
199 class UnqualifiedId;
202 class UnresolvedSetImpl;
204 class UsingDecl;
205 class UsingShadowDecl;
206 class ValueDecl;
207 class VarDecl;
209 class VisibilityAttr;
211 class IndirectFieldDecl;
214
215namespace sema {
216 class AccessedEntity;
217 class BlockScopeInfo;
218 class Capture;
220 class CapturingScopeInfo;
221 class CompoundScopeInfo;
222 class DelayedDiagnostic;
224 class FunctionScopeInfo;
225 class LambdaScopeInfo;
227 class SemaPPCallbacks;
229}
230
231namespace threadSafety {
232 class BeforeSet;
233 void threadSafetyCleanup(BeforeSet* Cache);
234}
235
236// FIXME: No way to easily map from TemplateTypeParmTypes to
237// TemplateTypeParmDecls, so we have this horrible PointerUnion.
238typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
240
241/// Describes whether we've seen any nullability information for the given
242/// file.
244 /// The first pointer declarator (of any pointer kind) in the file that does
245 /// not have a corresponding nullability annotation.
247
248 /// The end location for the first pointer declarator in the file. Used for
249 /// placing fix-its.
251
252 /// Which kind of pointer declarator we saw.
253 uint8_t PointerKind;
254
255 /// Whether we saw any type nullability annotations in the given file.
256 bool SawTypeNullability = false;
257};
258
259/// A mapping from file IDs to a record of whether we've seen nullability
260/// information in that file.
262 /// A mapping from file IDs to the nullability information for each file ID.
263 llvm::DenseMap<FileID, FileNullability> Map;
264
265 /// A single-element cache based on the file ID.
266 struct {
269 } Cache;
270
271public:
273 // Check the single-element cache.
274 if (file == Cache.File)
275 return Cache.Nullability;
276
277 // It's not in the single-element cache; flush the cache if we have one.
278 if (!Cache.File.isInvalid()) {
279 Map[Cache.File] = Cache.Nullability;
280 }
281
282 // Pull this entry into the cache.
283 Cache.File = file;
284 Cache.Nullability = Map[file];
285 return Cache.Nullability;
286 }
287};
288
289/// Keeps track of expected type during expression parsing. The type is tied to
290/// a particular token, all functions that update or consume the type take a
291/// start location of the token they are looking at as a parameter. This allows
292/// to avoid updating the type on hot paths in the parser.
294public:
297
301 /// Computing a type for the function argument may require running
302 /// overloading, so we postpone its computation until it is actually needed.
303 ///
304 /// Clients should be very careful when using this funciton, as it stores a
305 /// function_ref, clients should make sure all calls to get() with the same
306 /// location happen while function_ref is alive.
308 llvm::function_ref<QualType()> ComputeType);
309
312 SourceLocation OpLoc);
315 void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS);
316 /// Handles all type casts, including C-style cast, C++ casts, etc.
318
320 if (Tok != ExpectedLoc)
321 return QualType();
322 if (!Type.isNull())
323 return Type;
324 if (ComputeType)
325 return ComputeType();
326 return QualType();
327 }
328
329private:
330 /// Start position of a token for which we store expected type.
331 SourceLocation ExpectedLoc;
332 /// Expected type for a token starting at ExpectedLoc.
334 /// A function to compute expected type at ExpectedLoc. It is only considered
335 /// if Type is null.
336 llvm::function_ref<QualType()> ComputeType;
337};
338
339/// Sema - This implements semantic analysis and AST building for C.
340class Sema final {
341 Sema(const Sema &) = delete;
342 void operator=(const Sema &) = delete;
343
344 /// A key method to reduce duplicate debug info from Sema.
345 virtual void anchor();
346
347 ///Source of additional semantic information.
348 ExternalSemaSource *ExternalSource;
349
350 ///Whether Sema has generated a multiplexer and has to delete it.
351 bool isMultiplexExternalSource;
352
353 static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
354
355 bool isVisibleSlow(const NamedDecl *D);
356
357 /// Determine whether two declarations should be linked together, given that
358 /// the old declaration might not be visible and the new declaration might
359 /// not have external linkage.
360 bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
361 const NamedDecl *New) {
362 if (isVisible(Old))
363 return true;
364 // See comment in below overload for why it's safe to compute the linkage
365 // of the new declaration here.
366 if (New->isExternallyDeclarable()) {
367 assert(Old->isExternallyDeclarable() &&
368 "should not have found a non-externally-declarable previous decl");
369 return true;
370 }
371 return false;
372 }
373 bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
374
375 void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem,
376 QualType ResultTy,
377 ArrayRef<QualType> Args);
378
379public:
380 /// The maximum alignment, same as in llvm::Value. We duplicate them here
381 /// because that allows us not to duplicate the constants in clang code,
382 /// which we must to since we can't directly use the llvm constants.
383 /// The value is verified against llvm here: lib/CodeGen/CGDecl.cpp
384 ///
385 /// This is the greatest alignment value supported by load, store, and alloca
386 /// instructions, and global values.
387 static const unsigned MaxAlignmentExponent = 29;
388 static const unsigned MaximumAlignment = 1u << MaxAlignmentExponent;
389
393
396
403
404 /// Flag indicating whether or not to collect detailed statistics.
406
407 /// Code-completion consumer.
409
410 /// CurContext - This is the current declaration context of parsing.
412
413 /// Generally null except when we temporarily switch decl contexts,
414 /// like in \see ActOnObjCTemporaryExitContainerContext.
416
417 /// VAListTagName - The declaration name corresponding to __va_list_tag.
418 /// This is used as part of a hack to omit that class from ADL results.
420
421 bool MSStructPragmaOn; // True when \#pragma ms_struct on
422
423 /// Controls member pointer representation format under the MS ABI.
426
427 /// Stack of active SEH __finally scopes. Can be empty.
429
430 /// Source location for newly created implicit MSInheritanceAttrs
432
433 /// Holds TypoExprs that are created from `createDelayedTypo`. This is used by
434 /// `TransformTypos` in order to keep track of any TypoExprs that are created
435 /// recursively during typo correction and wipe them away if the correction
436 /// fails.
438
439 /// pragma clang section kind
448
453
459
465
467 PSK_Reset = 0x0, // #pragma ()
468 PSK_Set = 0x1, // #pragma (value)
469 PSK_Push = 0x2, // #pragma (push[, id])
470 PSK_Pop = 0x4, // #pragma (pop[, id])
471 PSK_Show = 0x8, // #pragma (show) -- only for "pack"!
472 PSK_Push_Set = PSK_Push | PSK_Set, // #pragma (push[, id], value)
473 PSK_Pop_Set = PSK_Pop | PSK_Set, // #pragma (pop[, id], value)
474 };
475
476 // #pragma pack and align.
478 public:
479 // `Native` represents default align mode, which may vary based on the
480 // platform.
481 enum Mode : unsigned char { Native, Natural, Packed, Mac68k };
482
483 // #pragma pack info constructor
484 AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
485 : PackAttr(true), AlignMode(M), PackNumber(Num), XLStack(IsXL) {
486 assert(Num == PackNumber && "The pack number has been truncated.");
487 }
488
489 // #pragma align info constructor
491 : PackAttr(false), AlignMode(M),
492 PackNumber(M == Packed ? 1 : UninitPackVal), XLStack(IsXL) {}
493
494 explicit AlignPackInfo(bool IsXL) : AlignPackInfo(Native, IsXL) {}
495
497
498 // When a AlignPackInfo itself cannot be used, this returns an 32-bit
499 // integer encoding for it. This should only be passed to
500 // AlignPackInfo::getFromRawEncoding, it should not be inspected directly.
501 static uint32_t getRawEncoding(const AlignPackInfo &Info) {
502 std::uint32_t Encoding{};
503 if (Info.IsXLStack())
504 Encoding |= IsXLMask;
505
506 Encoding |= static_cast<uint32_t>(Info.getAlignMode()) << 1;
507
508 if (Info.IsPackAttr())
509 Encoding |= PackAttrMask;
510
511 Encoding |= static_cast<uint32_t>(Info.getPackNumber()) << 4;
512
513 return Encoding;
514 }
515
516 static AlignPackInfo getFromRawEncoding(unsigned Encoding) {
517 bool IsXL = static_cast<bool>(Encoding & IsXLMask);
519 static_cast<AlignPackInfo::Mode>((Encoding & AlignModeMask) >> 1);
520 int PackNumber = (Encoding & PackNumMask) >> 4;
521
522 if (Encoding & PackAttrMask)
523 return AlignPackInfo(M, PackNumber, IsXL);
524
525 return AlignPackInfo(M, IsXL);
526 }
527
528 bool IsPackAttr() const { return PackAttr; }
529
530 bool IsAlignAttr() const { return !PackAttr; }
531
532 Mode getAlignMode() const { return AlignMode; }
533
534 unsigned getPackNumber() const { return PackNumber; }
535
536 bool IsPackSet() const {
537 // #pragma align, #pragma pack(), and #pragma pack(0) do not set the pack
538 // attriute on a decl.
539 return PackNumber != UninitPackVal && PackNumber != 0;
540 }
541
542 bool IsXLStack() const { return XLStack; }
543
544 bool operator==(const AlignPackInfo &Info) const {
545 return std::tie(AlignMode, PackNumber, PackAttr, XLStack) ==
546 std::tie(Info.AlignMode, Info.PackNumber, Info.PackAttr,
547 Info.XLStack);
548 }
549
550 bool operator!=(const AlignPackInfo &Info) const {
551 return !(*this == Info);
552 }
553
554 private:
555 /// \brief True if this is a pragma pack attribute,
556 /// not a pragma align attribute.
557 bool PackAttr;
558
559 /// \brief The alignment mode that is in effect.
560 Mode AlignMode;
561
562 /// \brief The pack number of the stack.
563 unsigned char PackNumber;
564
565 /// \brief True if it is a XL #pragma align/pack stack.
566 bool XLStack;
567
568 /// \brief Uninitialized pack value.
569 static constexpr unsigned char UninitPackVal = -1;
570
571 // Masks to encode and decode an AlignPackInfo.
572 static constexpr uint32_t IsXLMask{0x0000'0001};
573 static constexpr uint32_t AlignModeMask{0x0000'0006};
574 static constexpr uint32_t PackAttrMask{0x00000'0008};
575 static constexpr uint32_t PackNumMask{0x0000'01F0};
576 };
577
578 template<typename ValueType>
579 struct PragmaStack {
591
592 void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action,
593 llvm::StringRef StackSlotLabel, ValueType Value) {
594 if (Action == PSK_Reset) {
596 CurrentPragmaLocation = PragmaLocation;
597 return;
598 }
599 if (Action & PSK_Push)
600 Stack.emplace_back(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
601 PragmaLocation);
602 else if (Action & PSK_Pop) {
603 if (!StackSlotLabel.empty()) {
604 // If we've got a label, try to find it and jump there.
605 auto I = llvm::find_if(llvm::reverse(Stack), [&](const Slot &x) {
606 return x.StackSlotLabel == StackSlotLabel;
607 });
608 // If we found the label so pop from there.
609 if (I != Stack.rend()) {
610 CurrentValue = I->Value;
611 CurrentPragmaLocation = I->PragmaLocation;
612 Stack.erase(std::prev(I.base()), Stack.end());
613 }
614 } else if (!Stack.empty()) {
615 // We do not have a label, just pop the last entry.
616 CurrentValue = Stack.back().Value;
617 CurrentPragmaLocation = Stack.back().PragmaLocation;
618 Stack.pop_back();
619 }
620 }
621 if (Action & PSK_Set) {
623 CurrentPragmaLocation = PragmaLocation;
624 }
625 }
626
627 // MSVC seems to add artificial slots to #pragma stacks on entering a C++
628 // method body to restore the stacks on exit, so it works like this:
629 //
630 // struct S {
631 // #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
632 // void Method {}
633 // #pragma <name>(pop, InternalPragmaSlot)
634 // };
635 //
636 // It works even with #pragma vtordisp, although MSVC doesn't support
637 // #pragma vtordisp(push [, id], n)
638 // syntax.
639 //
640 // Push / pop a named sentinel slot.
641 void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
642 assert((Action == PSK_Push || Action == PSK_Pop) &&
643 "Can only push / pop #pragma stack sentinels!");
645 }
646
647 // Constructors.
648 explicit PragmaStack(const ValueType &Default)
650
651 bool hasValue() const { return CurrentValue != DefaultValue; }
652
654 ValueType DefaultValue; // Value used for PSK_Reset action.
655 ValueType CurrentValue;
657 };
658 // FIXME: We should serialize / deserialize these if they occur in a PCH (but
659 // we shouldn't do so if they're in a module).
660
661 /// Whether to insert vtordisps prior to virtual bases in the Microsoft
662 /// C++ ABI. Possible values are 0, 1, and 2, which mean:
663 ///
664 /// 0: Suppress all vtordisps
665 /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
666 /// structors
667 /// 2: Always insert vtordisps to support RTTI on partially constructed
668 /// objects
671 // The current #pragma align/pack values and locations at each #include.
678 // Segment #pragmas.
683
684 // This stack tracks the current state of Sema.CurFPFeatures.
687 FPOptionsOverride result;
688 if (!FpPragmaStack.hasValue()) {
689 result = FPOptionsOverride();
690 } else {
691 result = FpPragmaStack.CurrentValue;
692 }
693 return result;
694 }
695
696 // RAII object to push / pop sentinel slots for all MS #pragma stacks.
697 // Actions should be performed only if we enter / exit a C++ method body.
699 public:
700 PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
702
703 private:
704 Sema &S;
705 StringRef SlotLabel;
706 bool ShouldAct;
707 };
708
709 /// A mapping that describes the nullability we've seen in each header file.
711
712 /// Last section used with #pragma init_seg.
715
716 /// VisContext - Manages the stack for \#pragma GCC visibility.
717 void *VisContext; // Really a "PragmaVisStack*"
718
719 /// This an attribute introduced by \#pragma clang attribute.
726
727 /// A push'd group of PragmaAttributeEntries.
729 /// The location of the push attribute.
731 /// The namespace of this push group.
734 };
735
737
738 /// The declaration that is currently receiving an attribute from the
739 /// #pragma attribute stack.
741
742 /// This represents the last location of a "#pragma clang optimize off"
743 /// directive if such a directive has not been closed by an "on" yet. If
744 /// optimizations are currently "on", this is set to an invalid location.
746
747 /// Flag indicating if Sema is building a recovery call expression.
748 ///
749 /// This flag is used to avoid building recovery call expressions
750 /// if Sema is already doing so, which would cause infinite recursions.
752
753 /// Used to control the generation of ExprWithCleanups.
755
756 /// ExprCleanupObjects - This is the stack of objects requiring
757 /// cleanup that are created by the current full expression.
759
760 /// Store a set of either DeclRefExprs or MemberExprs that contain a reference
761 /// to a variable (constant) that may or may not be odr-used in this Expr, and
762 /// we won't know until all lvalue-to-rvalue and discarded value conversions
763 /// have been applied to all subexpressions of the enclosing full expression.
764 /// This is cleared at the end of each full expression.
765 using MaybeODRUseExprSet = llvm::SetVector<Expr *, SmallVector<Expr *, 4>,
768
769 std::unique_ptr<sema::FunctionScopeInfo> CachedFunctionScope;
770
771 /// Stack containing information about each of the nested
772 /// function, block, and method scopes that are currently active.
774
775 /// The index of the first FunctionScope that corresponds to the current
776 /// context.
778
780 return llvm::makeArrayRef(FunctionScopes.begin() + FunctionScopesStart,
781 FunctionScopes.end());
782 }
783
784 /// Stack containing information needed when in C++2a an 'auto' is encountered
785 /// in a function declaration parameter type specifier in order to invent a
786 /// corresponding template parameter in the enclosing abbreviated function
787 /// template. This information is also present in LambdaScopeInfo, stored in
788 /// the FunctionScopes stack.
790
791 /// The index of the first InventedParameterInfo that refers to the current
792 /// context.
794
800
804
805 /// ExtVectorDecls - This is a list all the extended vector types. This allows
806 /// us to associate a raw vector type with one of the ext_vector type names.
807 /// This is only necessary for issuing pretty diagnostics.
809
810 /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
811 std::unique_ptr<CXXFieldCollector> FieldCollector;
812
814
815 /// Set containing all declared private fields that are not used.
817
818 /// Set containing all typedefs that are likely unused.
821
822 /// Delete-expressions to be analyzed at the end of translation unit
823 ///
824 /// This list contains class members, and locations of delete-expressions
825 /// that could not be proven as to whether they mismatch with new-expression
826 /// used in initializer of the field.
827 typedef std::pair<SourceLocation, bool> DeleteExprLoc;
829 llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
830
832
833 /// PureVirtualClassDiagSet - a set of class declarations which we have
834 /// emitted a list of pure virtual functions. Used to prevent emitting the
835 /// same list more than once.
836 std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
837
838 /// ParsingInitForAutoVars - a set of declarations with auto types for which
839 /// we are currently parsing the initializer.
841
842 /// Look for a locally scoped extern "C" declaration by the given name.
844
848
849 /// All the tentative definitions encountered in the TU.
851
852 /// All the external declarations encoutered and used in the TU.
854
858
859 /// The set of file scoped decls seen so far that have not been used
860 /// and must warn if not used. Only contains the first declaration.
862
866
867 /// All the delegating constructors seen so far in the file, used for
868 /// cycle detection at the end of the TU.
870
871 /// All the overriding functions seen during a class definition
872 /// that had their exception spec checks delayed, plus the overridden
873 /// function.
876
877 /// All the function redeclarations seen during a class definition that had
878 /// their exception spec checks delayed, plus the prior declaration they
879 /// should be checked against. Except during error recovery, the new decl
880 /// should always be a friend declaration, as that's the only valid way to
881 /// redeclare a special member before its class is complete.
884
885 typedef llvm::MapVector<const FunctionDecl *,
886 std::unique_ptr<LateParsedTemplate>>
889
890 /// Callback to the parser to parse templated functions when needed.
891 typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
892 typedef void LateTemplateParserCleanupCB(void *P);
896
898 LateTemplateParserCleanupCB *LTPCleanup,
899 void *P) {
900 LateTemplateParser = LTP;
901 LateTemplateParserCleanup = LTPCleanup;
902 OpaqueParser = P;
903 }
904
905 class DelayedDiagnostics;
906
913
914 /// A class which encapsulates the logic for delaying diagnostics
915 /// during parsing and other processing.
917 /// The current pool of diagnostics into which delayed
918 /// diagnostics should go.
920
921 public:
922 DelayedDiagnostics() : CurPool(nullptr) {}
923
924 /// Adds a delayed diagnostic.
925 void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
926
927 /// Determines whether diagnostics should be delayed.
928 bool shouldDelayDiagnostics() { return CurPool != nullptr; }
929
930 /// Returns the current delayed-diagnostics pool.
932 return CurPool;
933 }
934
935 /// Enter a new scope. Access and deprecation diagnostics will be
936 /// collected in this pool.
939 state.SavedPool = CurPool;
940 CurPool = &pool;
941 return state;
942 }
943
944 /// Leave a delayed-diagnostic state that was previously pushed.
945 /// Do not emit any of the diagnostics. This is performed as part
946 /// of the bookkeeping of popping a pool "properly".
948 CurPool = state.SavedPool;
949 }
950
951 /// Enter a new scope where access and deprecation diagnostics are
952 /// not delayed.
955 state.SavedPool = CurPool;
956 CurPool = nullptr;
957 return state;
958 }
959
960 /// Undo a previous pushUndelayed().
962 assert(CurPool == nullptr);
963 CurPool = state.SavedPool;
964 }
966
967 /// A RAII object to temporarily push a declaration context.
969 private:
970 Sema &S;
971 DeclContext *SavedContext;
972 ProcessingContextState SavedContextState;
973 QualType SavedCXXThisTypeOverride;
974 unsigned SavedFunctionScopesStart;
975 unsigned SavedInventedParameterInfosStart;
976
977 public:
978 ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
979 : S(S), SavedContext(S.CurContext),
980 SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
981 SavedCXXThisTypeOverride(S.CXXThisTypeOverride),
982 SavedFunctionScopesStart(S.FunctionScopesStart),
983 SavedInventedParameterInfosStart(S.InventedParameterInfosStart)
984 {
985 assert(ContextToPush && "pushing null context");
986 S.CurContext = ContextToPush;
987 if (NewThisContext)
988 S.CXXThisTypeOverride = QualType();
989 // Any saved FunctionScopes do not refer to this context.
990 S.FunctionScopesStart = S.FunctionScopes.size();
991 S.InventedParameterInfosStart = S.InventedParameterInfos.size();
992 }
993
994 void pop() {
995 if (!SavedContext) return;
996 S.CurContext = SavedContext;
997 S.DelayedDiagnostics.popUndelayed(SavedContextState);
998 S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
999 S.FunctionScopesStart = SavedFunctionScopesStart;
1000 S.InventedParameterInfosStart = SavedInventedParameterInfosStart;
1001 SavedContext = nullptr;
1002 }
1003
1005 pop();
1006 }
1007 };
1008
1009 /// Whether the AST is currently being rebuilt to correct immediate
1010 /// invocations. Immediate invocation candidates and references to consteval
1011 /// functions aren't tracked when this is set.
1013
1014 /// Used to change context to isConstantEvaluated without pushing a heavy
1015 /// ExpressionEvaluationContextRecord object.
1017
1019 return ExprEvalContexts.back().isConstantEvaluated() ||
1021 }
1022
1023 /// RAII object to handle the state changes required to synthesize
1024 /// a function body.
1026 Sema &S;
1027 Sema::ContextRAII SavedContext;
1028 bool PushedCodeSynthesisContext = false;
1029
1030 public:
1032 : S(S), SavedContext(S, DC) {
1033 S.PushFunctionScope();
1034 S.PushExpressionEvaluationContext(
1036 if (auto *FD = dyn_cast<FunctionDecl>(DC))
1037 FD->setWillHaveBody(true);
1038 else
1039 assert(isa<ObjCMethodDecl>(DC));
1040 }
1041
1043 assert(!PushedCodeSynthesisContext);
1044
1047 Ctx.PointOfInstantiation = UseLoc;
1048 Ctx.Entity = cast<Decl>(S.CurContext);
1049 S.pushCodeSynthesisContext(Ctx);
1050
1051 PushedCodeSynthesisContext = true;
1052 }
1053
1055 if (PushedCodeSynthesisContext)
1056 S.popCodeSynthesisContext();
1057 if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext))
1058 FD->setWillHaveBody(false);
1059 S.PopExpressionEvaluationContext();
1060 S.PopFunctionScopeInfo();
1061 }
1062 };
1063
1064 /// WeakUndeclaredIdentifiers - Identifiers contained in
1065 /// \#pragma weak before declared. rare. may alias another
1066 /// identifier, declared or undeclared
1067 llvm::MapVector<IdentifierInfo *, WeakInfo> WeakUndeclaredIdentifiers;
1068
1069 /// ExtnameUndeclaredIdentifiers - Identifiers contained in
1070 /// \#pragma redefine_extname before declared. Used in Solaris system headers
1071 /// to define functions that occur in multiple standards to call the version
1072 /// in the currently selected standard.
1073 llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers;
1074
1075
1076 /// Load weak undeclared identifiers from the external source.
1078
1079 /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
1080 /// \#pragma weak during processing of other Decls.
1081 /// I couldn't figure out a clean way to generate these in-line, so
1082 /// we store them here and handle separately -- which is a hack.
1083 /// It would be best to refactor this.
1085
1087
1088 /// Translation Unit Scope - useful to Objective-C actions that need
1089 /// to lookup file scope declarations in the "ordinary" C decl namespace.
1090 /// For example, user-defined classes, built-in "id" type, etc.
1092
1093 /// The C++ "std" namespace, where the standard library resides.
1095
1096 /// The C++ "std::bad_alloc" class, which is defined by the C++
1097 /// standard library.
1099
1100 /// The C++ "std::align_val_t" enum class, which is defined by the C++
1101 /// standard library.
1103
1104 /// The C++ "std::experimental" namespace, where the experimental parts
1105 /// of the standard library resides.
1107
1108 /// The C++ "std::initializer_list" template, which is defined in
1109 /// <initializer_list>.
1111
1112 /// The C++ "std::coroutine_traits" template, which is defined in
1113 /// <coroutine_traits>
1115
1116 /// The C++ "type_info" declaration, which is defined in <typeinfo>.
1118
1119 /// The MSVC "_GUID" struct, which is defined in MSVC header files.
1121
1122 /// Caches identifiers/selectors for NSFoundation APIs.
1123 std::unique_ptr<NSAPI> NSAPIObj;
1124
1125 /// The declaration of the Objective-C NSNumber class.
1127
1128 /// The declaration of the Objective-C NSValue class.
1130
1131 /// Pointer to NSNumber type (NSNumber *).
1133
1134 /// Pointer to NSValue type (NSValue *).
1136
1137 /// The Objective-C NSNumber methods used to create NSNumber literals.
1139
1140 /// The declaration of the Objective-C NSString class.
1142
1143 /// Pointer to NSString type (NSString *).
1145
1146 /// The declaration of the stringWithUTF8String: method.
1148
1149 /// The declaration of the valueWithBytes:objCType: method.
1151
1152 /// The declaration of the Objective-C NSArray class.
1154
1155 /// The declaration of the arrayWithObjects:count: method.
1157
1158 /// The declaration of the Objective-C NSDictionary class.
1160
1161 /// The declaration of the dictionaryWithObjects:forKeys:count: method.
1163
1164 /// id<NSCopying> type.
1166
1167 /// will hold 'respondsToSelector:'
1169
1170 /// A flag to remember whether the implicit forms of operator new and delete
1171 /// have been declared.
1173
1174 /// Describes how the expressions currently being parsed are
1175 /// evaluated at run-time, if at all.
1177 /// The current expression and its subexpressions occur within an
1178 /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
1179 /// \c sizeof, where the type of the expression may be significant but
1180 /// no code will be generated to evaluate the value of the expression at
1181 /// run time.
1183
1184 /// The current expression occurs within a braced-init-list within
1185 /// an unevaluated operand. This is mostly like a regular unevaluated
1186 /// context, except that we still instantiate constexpr functions that are
1187 /// referenced here so that we can perform narrowing checks correctly.
1189
1190 /// The current expression occurs within a discarded statement.
1191 /// This behaves largely similarly to an unevaluated operand in preventing
1192 /// definitions from being required, but not in other ways.
1194
1195 /// The current expression occurs within an unevaluated
1196 /// operand that unconditionally permits abstract references to
1197 /// fields, such as a SIZE operator in MS-style inline assembly.
1199
1200 /// The current context is "potentially evaluated" in C++11 terms,
1201 /// but the expression is evaluated at compile-time (like the values of
1202 /// cases in a switch statement).
1204
1205 /// The current expression is potentially evaluated at run time,
1206 /// which means that code may be generated to evaluate the value of the
1207 /// expression at run time.
1209
1210 /// The current expression is potentially evaluated, but any
1211 /// declarations referenced inside that expression are only used if
1212 /// in fact the current expression is used.
1213 ///
1214 /// This value is used when parsing default function arguments, for which
1215 /// we would like to provide diagnostics (e.g., passing non-POD arguments
1216 /// through varargs) but do not want to mark declarations as "referenced"
1217 /// until the default argument is used.
1219 };
1220
1221 using ImmediateInvocationCandidate = llvm::PointerIntPair<ConstantExpr *, 1>;
1222
1223 /// Data structure used to record current or nested
1224 /// expression evaluation contexts.
1226 /// The expression evaluation context.
1228
1229 /// Whether the enclosing context needed a cleanup.
1231
1232 /// The number of active cleanup objects when we entered
1233 /// this expression evaluation context.
1235
1236 /// The number of typos encountered during this expression evaluation
1237 /// context (i.e. the number of TypoExprs created).
1238 unsigned NumTypos;
1239
1241
1242 /// The lambdas that are present within this context, if it
1243 /// is indeed an unevaluated context.
1245
1246 /// The declaration that provides context for lambda expressions
1247 /// and block literals if the normal declaration context does not
1248 /// suffice, e.g., in a default function argument.
1250
1251 /// If we are processing a decltype type, a set of call expressions
1252 /// for which we have deferred checking the completeness of the return type.
1254
1255 /// If we are processing a decltype type, a set of temporary binding
1256 /// expressions for which we have deferred checking the destructor.
1258
1260
1261 /// Expressions appearing as the LHS of a volatile assignment in this
1262 /// context. We produce a warning for these when popping the context if
1263 /// they are not discarded-value expressions nor unevaluated operands.
1265
1266 /// Set of candidates for starting an immediate invocation.
1268
1269 /// Set of DeclRefExprs referencing a consteval function when used in a
1270 /// context not already known to be immediately invoked.
1272
1273 /// \brief Describes whether we are in an expression constext which we have
1274 /// to handle differently.
1278
1287
1296 };
1297
1298 /// A stack of expression evaluation contexts.
1300
1301 /// Emit a warning for all pending noderef expressions that we recorded.
1303
1304 /// Compute the mangling number context for a lambda expression or
1305 /// block literal. Also return the extra mangling decl if any.
1306 ///
1307 /// \param DC - The DeclContext containing the lambda expression or
1308 /// block literal.
1309 std::tuple<MangleNumberingContext *, Decl *>
1311
1312
1313 /// SpecialMemberOverloadResult - The overloading result for a special member
1314 /// function.
1315 ///
1316 /// This is basically a wrapper around PointerIntPair. The lowest bits of the
1317 /// integer are used to determine whether overload resolution succeeded.
1319 public:
1325
1326 private:
1327 llvm::PointerIntPair<CXXMethodDecl*, 2> Pair;
1328
1329 public:
1332 : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {}
1333
1334 CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
1335 void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
1336
1337 Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
1338 void setKind(Kind K) { Pair.setInt(K); }
1339 };
1340
1342 : public llvm::FastFoldingSetNode,
1344 public:
1345 SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
1346 : FastFoldingSetNode(ID)
1347 {}
1348 };
1349
1350 /// A cache of special member function overload resolution results
1351 /// for C++ records.
1352 llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
1353
1354 /// A cache of the flags available in enumerations with the flag_bits
1355 /// attribute.
1356 mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache;
1357
1358 /// The kind of translation unit we are processing.
1359 ///
1360 /// When we're processing a complete translation unit, Sema will perform
1361 /// end-of-translation-unit semantic tasks (such as creating
1362 /// initializers for tentative definitions in C) once parsing has
1363 /// completed. Modules and precompiled headers perform different kinds of
1364 /// checks.
1366
1367 llvm::BumpPtrAllocator BumpAlloc;
1368
1369 /// The number of SFINAE diagnostics that have been trapped.
1371
1372 typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
1374
1375 /// A mapping from parameters with unparsed default arguments to the
1376 /// set of instantiations of each parameter.
1377 ///
1378 /// This mapping is a temporary data structure used when parsing
1379 /// nested class templates or nested classes of class templates,
1380 /// where we might end up instantiating an inner class before the
1381 /// default arguments of its methods have been parsed.
1383
1384 // Contains the locations of the beginning of unparsed default
1385 // argument locations.
1386 llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
1387
1388 /// UndefinedInternals - all the used, undefined objects which require a
1389 /// definition in this translation unit.
1390 llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
1391
1392 /// Determine if VD, which must be a variable or function, is an external
1393 /// symbol that nonetheless can't be referenced from outside this translation
1394 /// unit because its type has no linkage and it's not extern "C".
1396
1397 /// Obtain a sorted list of functions that are undefined but ODR-used.
1399 SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined);
1400
1401 /// Retrieves list of suspicious delete-expressions that will be checked at
1402 /// the end of translation unit.
1403 const llvm::MapVector<FieldDecl *, DeleteLocs> &
1405
1406 typedef std::pair<ObjCMethodList, ObjCMethodList> GlobalMethods;
1407 typedef llvm::DenseMap<Selector, GlobalMethods> GlobalMethodPool;
1408
1409 /// Method Pool - allows efficient lookup when typechecking messages to "id".
1410 /// We need to maintain a list, since selectors can have differing signatures
1411 /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
1412 /// of selectors are "overloaded").
1413 /// At the head of the list it is recorded whether there were 0, 1, or >= 2
1414 /// methods inside categories with a particular selector.
1416
1417 /// Method selectors used in a \@selector expression. Used for implementation
1418 /// of -Wselector.
1419 llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
1420
1421 /// List of SourceLocations where 'self' is implicitly retained inside a
1422 /// block.
1425
1426 /// Kinds of C++ special members.
1436
1437 typedef llvm::PointerIntPair<CXXRecordDecl *, 3, CXXSpecialMember>
1439
1440 /// The C++ special members which we are currently in the process of
1441 /// declaring. If this process recursively triggers the declaration of the
1442 /// same special member, we should act as if it is not yet declared.
1444
1445 /// Kinds of defaulted comparison operator functions.
1446 enum class DefaultedComparisonKind : unsigned char {
1447 /// This is not a defaultable comparison operator.
1448 None,
1449 /// This is an operator== that should be implemented as a series of
1450 /// subobject comparisons.
1451 Equal,
1452 /// This is an operator<=> that should be implemented as a series of
1453 /// subobject comparisons.
1454 ThreeWay,
1455 /// This is an operator!= that should be implemented as a rewrite in terms
1456 /// of a == comparison.
1457 NotEqual,
1458 /// This is an <, <=, >, or >= that should be implemented as a rewrite in
1459 /// terms of a <=> comparison.
1460 Relational,
1461 };
1462
1463 /// The function definitions which were renamed as part of typo-correction
1464 /// to match their respective declarations. We want to keep track of them
1465 /// to ensure that we don't emit a "redefinition" error if we encounter a
1466 /// correctly named definition after the renamed definition.
1468
1469 /// Stack of types that correspond to the parameter entities that are
1470 /// currently being copy-initialized. Can be empty.
1472
1473 void ReadMethodPool(Selector Sel);
1475
1476 /// Private Helper predicate to check for 'self'.
1477 bool isSelfExpr(Expr *RExpr);
1478 bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
1479
1480 /// Cause the active diagnostic on the DiagosticsEngine to be
1481 /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
1482 /// should not be used elsewhere.
1483 void EmitCurrentDiagnostic(unsigned DiagID);
1484
1485 /// Records and restores the CurFPFeatures state on entry/exit of compound
1486 /// statements.
1488 public:
1489 FPFeaturesStateRAII(Sema &S) : S(S), OldFPFeaturesState(S.CurFPFeatures) {
1490 OldOverrides = S.FpPragmaStack.CurrentValue;
1491 }
1493 S.CurFPFeatures = OldFPFeaturesState;
1494 S.FpPragmaStack.CurrentValue = OldOverrides;
1495 }
1496 FPOptionsOverride getOverrides() { return OldOverrides; }
1497
1498 private:
1499 Sema& S;
1500 FPOptions OldFPFeaturesState;
1501 FPOptionsOverride OldOverrides;
1502 };
1503
1504 void addImplicitTypedef(StringRef Name, QualType T);
1505
1507
1508public:
1509 Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
1511 CodeCompleteConsumer *CompletionConsumer = nullptr);
1512 ~Sema();
1513
1514 /// Perform initialization that occurs after the parser has been
1515 /// initialized but before it parses anything.
1516 void Initialize();
1517
1518 const LangOptions &getLangOpts() const { return LangOpts; }
1521
1524 Preprocessor &getPreprocessor() const { return PP; }
1525 ASTContext &getASTContext() const { return Context; }
1528 ExternalSemaSource* getExternalSource() const { return ExternalSource; }
1529
1530 ///Registers an external source. If an external source already exists,
1531 /// creates a multiplex external source and appends to it.
1532 ///
1533 ///\param[in] E - A non-null external sema source.
1534 ///
1536
1537 void PrintStats() const;
1538
1539 /// Warn that the stack is nearly exhausted.
1541
1542 /// Run some code with "sufficient" stack space. (Currently, at least 256K is
1543 /// guaranteed). Produces a warning if we're low on stack space and allocates
1544 /// more in that case. Use this in code that may recurse deeply (for example,
1545 /// in template instantiation) to avoid stack overflow.
1547 llvm::function_ref<void()> Fn);
1548
1549 /// Helper class that creates diagnostics with optional
1550 /// template instantiation stacks.
1551 ///
1552 /// This class provides a wrapper around the basic DiagnosticBuilder
1553 /// class that emits diagnostics. ImmediateDiagBuilder is
1554 /// responsible for emitting the diagnostic (as DiagnosticBuilder
1555 /// does) and, if the diagnostic comes from inside a template
1556 /// instantiation, printing the template instantiation stack as
1557 /// well.
1559 Sema &SemaRef;
1560 unsigned DiagID;
1561
1562 public:
1563 ImmediateDiagBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
1564 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
1565 ImmediateDiagBuilder(DiagnosticBuilder &&DB, Sema &SemaRef, unsigned DiagID)
1566 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
1567
1568 // This is a cunning lie. DiagnosticBuilder actually performs move
1569 // construction in its copy constructor (but due to varied uses, it's not
1570 // possible to conveniently express this as actual move construction). So
1571 // the default copy ctor here is fine, because the base class disables the
1572 // source anyway, so the user-defined ~ImmediateDiagBuilder is a safe no-op
1573 // in that case anwyay.
1575
1577 // If we aren't active, there is nothing to do.
1578 if (!isActive()) return;
1579
1580 // Otherwise, we need to emit the diagnostic. First clear the diagnostic
1581 // builder itself so it won't emit the diagnostic in its own destructor.
1582 //
1583 // This seems wasteful, in that as written the DiagnosticBuilder dtor will
1584 // do its own needless checks to see if the diagnostic needs to be
1585 // emitted. However, because we take care to ensure that the builder
1586 // objects never escape, a sufficiently smart compiler will be able to
1587 // eliminate that code.
1588 Clear();
1589
1590 // Dispatch to Sema to emit the diagnostic.
1591 SemaRef.EmitCurrentDiagnostic(DiagID);
1592 }
1593
1594 /// Teach operator<< to produce an object of the correct type.
1595 template <typename T>
1597 operator<<(const ImmediateDiagBuilder &Diag, const T &Value) {
1598 const DiagnosticBuilder &BaseDiag = Diag;
1599 BaseDiag << Value;
1600 return Diag;
1601 }
1602
1603 // It is necessary to limit this to rvalue reference to avoid calling this
1604 // function with a bitfield lvalue argument since non-const reference to
1605 // bitfield is not allowed.
1606 template <typename T, typename = typename std::enable_if<
1607 !std::is_lvalue_reference<T>::value>::type>
1609 const DiagnosticBuilder &BaseDiag = *this;
1610 BaseDiag << std::move(V);
1611 return *this;
1612 }
1613 };
1614
1615 /// A generic diagnostic builder for errors which may or may not be deferred.
1616 ///
1617 /// In CUDA, there exist constructs (e.g. variable-length arrays, try/catch)
1618 /// which are not allowed to appear inside __device__ functions and are
1619 /// allowed to appear in __host__ __device__ functions only if the host+device
1620 /// function is never codegen'ed.
1621 ///
1622 /// To handle this, we use the notion of "deferred diagnostics", where we
1623 /// attach a diagnostic to a FunctionDecl that's emitted iff it's codegen'ed.
1624 ///
1625 /// This class lets you emit either a regular diagnostic, a deferred
1626 /// diagnostic, or no diagnostic at all, according to an argument you pass to
1627 /// its constructor, thus simplifying the process of creating these "maybe
1628 /// deferred" diagnostics.
1630 public:
1631 enum Kind {
1632 /// Emit no diagnostics.
1634 /// Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
1636 /// Emit the diagnostic immediately, and, if it's a warning or error, also
1637 /// emit a call stack showing how this function can be reached by an a
1638 /// priori known-emitted function.
1640 /// Create a deferred diagnostic, which is emitted only if the function
1641 /// it's attached to is codegen'ed. Also emit a call stack as with
1642 /// K_ImmediateWithCallStack.
1645
1646 SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID,
1647 FunctionDecl *Fn, Sema &S);
1651
1652 bool isImmediate() const { return ImmediateDiag.hasValue(); }
1653
1654 /// Convertible to bool: True if we immediately emitted an error, false if
1655 /// we didn't emit an error or we created a deferred error.
1656 ///
1657 /// Example usage:
1658 ///
1659 /// if (SemaDiagnosticBuilder(...) << foo << bar)
1660 /// return ExprError();
1661 ///
1662 /// But see CUDADiagIfDeviceCode() and CUDADiagIfHostCode() -- you probably
1663 /// want to use these instead of creating a SemaDiagnosticBuilder yourself.
1664 operator bool() const { return isImmediate(); }
1665
1666 template <typename T>
1668 operator<<(const SemaDiagnosticBuilder &Diag, const T &Value) {
1669 if (Diag.ImmediateDiag.hasValue())
1670 *Diag.ImmediateDiag << Value;
1671 else if (Diag.PartialDiagId.hasValue())
1672 Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second
1673 << Value;
1674 return Diag;
1675 }
1676
1677 // It is necessary to limit this to rvalue reference to avoid calling this
1678 // function with a bitfield lvalue argument since non-const reference to
1679 // bitfield is not allowed.
1680 template <typename T, typename = typename std::enable_if<
1681 !std::is_lvalue_reference<T>::value>::type>
1683 if (ImmediateDiag.hasValue())
1684 *ImmediateDiag << std::move(V);
1685 else if (PartialDiagId.hasValue())
1686 S.DeviceDeferredDiags[Fn][*PartialDiagId].second << std::move(V);
1687 return *this;
1688 }
1689
1692 if (Diag.ImmediateDiag.hasValue())
1693 PD.Emit(*Diag.ImmediateDiag);
1694 else if (Diag.PartialDiagId.hasValue())
1695 Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second = PD;
1696 return Diag;
1697 }
1698
1699 void AddFixItHint(const FixItHint &Hint) const {
1700 if (ImmediateDiag.hasValue())
1701 ImmediateDiag->AddFixItHint(Hint);
1702 else if (PartialDiagId.hasValue())
1703 S.DeviceDeferredDiags[Fn][*PartialDiagId].second.AddFixItHint(Hint);
1704 }
1705
1707 return ExprError();
1708 }
1710 return StmtError();
1711 }
1712 operator ExprResult() const { return ExprError(); }
1713 operator StmtResult() const { return StmtError(); }
1714 operator TypeResult() const { return TypeError(); }
1715 operator DeclResult() const { return DeclResult(true); }
1716 operator MemInitResult() const { return MemInitResult(true); }
1717
1718 private:
1719 Sema &S;
1720 SourceLocation Loc;
1721 unsigned DiagID;
1722 FunctionDecl *Fn;
1723 bool ShowCallStack;
1724
1725 // Invariant: At most one of these Optionals has a value.
1726 // FIXME: Switch these to a Variant once that exists.
1728 llvm::Optional<unsigned> PartialDiagId;
1729 };
1730
1731 /// Is the last error level diagnostic immediate. This is used to determined
1732 /// whether the next info diagnostic should be immediate.
1734
1735 /// Emit a diagnostic.
1736 SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID,
1737 bool DeferHint = false);
1738
1739 /// Emit a partial diagnostic.
1741 bool DeferHint = false);
1742
1743 /// Build a partial diagnostic.
1744 PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1745
1746 /// Whether uncompilable error has occurred. This includes error happens
1747 /// in deferred diagnostics.
1748 bool hasUncompilableErrorOccurred() const;
1749
1750 bool findMacroSpelling(SourceLocation &loc, StringRef name);
1751
1752 /// Get a string to suggest for zero-initialization of a type.
1753 std::string
1755 std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
1756
1757 /// Calls \c Lexer::getLocForEndOfToken()
1759
1760 /// Retrieve the module loader associated with the preprocessor.
1762
1763 /// Invent a new identifier for parameters of abbreviated templates.
1766 unsigned Index);
1767
1769
1770 private:
1771 /// Function or variable declarations to be checked for whether the deferred
1772 /// diagnostics should be emitted.
1773 SmallVector<Decl *, 4> DeclsToCheckForDeferredDiags;
1774
1775 public:
1776 // Emit all deferred diagnostics.
1777 void emitDeferredDiags();
1778
1780 /// The global module fragment, between 'module;' and a module-declaration.
1782 /// A normal translation unit fragment. For a non-module unit, this is the
1783 /// entire translation unit. Otherwise, it runs from the module-declaration
1784 /// to the private-module-fragment (if any) or the end of the TU (if not).
1786 /// The private module fragment, between 'module :private;' and the end of
1787 /// the translation unit.
1788 Private
1790
1794
1796
1798
1799 void PushFunctionScope();
1800 void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
1802
1803 /// This is used to inform Sema what the current TemplateParameterDepth
1804 /// is during Parsing. Currently it is used to pass on the depth
1805 /// when parsing generic lambda 'auto' parameters.
1806 void RecordParsingTemplateParameterDepth(unsigned Depth);
1807
1808 void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
1810 unsigned OpenMPCaptureLevel = 0);
1811
1812 /// Custom deleter to allow FunctionScopeInfos to be kept alive for a short
1813 /// time after they've been popped.
1815 Sema *Self;
1816
1817 public:
1818 explicit PoppedFunctionScopeDeleter(Sema *Self) : Self(Self) {}
1820 };
1821
1823 std::unique_ptr<sema::FunctionScopeInfo, PoppedFunctionScopeDeleter>;
1824
1827 const Decl *D = nullptr,
1828 QualType BlockType = QualType());
1829
1831 return FunctionScopes.empty() ? nullptr : FunctionScopes.back();
1832 }
1833
1835
1839
1840 void PushCompoundScope(bool IsStmtExpr);
1841 void PopCompoundScope();
1842
1844
1846
1847 /// Retrieve the current block, if any.
1849
1850 /// Get the innermost lambda enclosing the current location, if any. This
1851 /// looks through intervening non-lambda scopes such as local functions and
1852 /// blocks.
1854
1855 /// Retrieve the current lambda scope info, if any.
1856 /// \param IgnoreNonLambdaCapturingScope true if should find the top-most
1857 /// lambda scope info ignoring all inner capturing scopes that are not
1858 /// lambda scopes.
1860 getCurLambda(bool IgnoreNonLambdaCapturingScope = false);
1861
1862 /// Retrieve the current generic lambda info, if any.
1864
1865 /// Retrieve the current captured region, if any.
1867
1868 /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
1870
1871 /// Called before parsing a function declarator belonging to a function
1872 /// declaration.
1874 unsigned TemplateParameterDepth);
1875
1876 /// Called after parsing a function declarator belonging to a function
1877 /// declaration.
1879
1880 void ActOnComment(SourceRange Comment);
1881
1882 //===--------------------------------------------------------------------===//
1883 // Type Analysis / Processing: SemaType.cpp.
1884 //
1885
1887 const DeclSpec *DS = nullptr);
1888 QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
1889 const DeclSpec *DS = nullptr);
1891 SourceLocation Loc, DeclarationName Entity);
1892 QualType BuildReferenceType(QualType T, bool LValueRef,
1893 SourceLocation Loc, DeclarationName Entity);
1895 Expr *ArraySize, unsigned Quals,
1896 SourceRange Brackets, DeclarationName Entity);
1897 QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc);
1899 SourceLocation AttrLoc);
1900 QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns,
1901 SourceLocation AttrLoc);
1902
1903 QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace,
1904 SourceLocation AttrLoc);
1905
1906 /// Same as above, but constructs the AddressSpace index if not provided.
1908 SourceLocation AttrLoc);
1909
1911
1913
1914 /// Build a function type.
1915 ///
1916 /// This routine checks the function type according to C++ rules and
1917 /// under the assumption that the result type and parameter types have
1918 /// just been instantiated from a template. It therefore duplicates
1919 /// some of the behavior of GetTypeForDeclarator, but in a much
1920 /// simpler form that is only suitable for this narrow use case.
1921 ///
1922 /// \param T The return type of the function.
1923 ///
1924 /// \param ParamTypes The parameter types of the function. This array
1925 /// will be modified to account for adjustments to the types of the
1926 /// function parameters.
1927 ///
1928 /// \param Loc The location of the entity whose type involves this
1929 /// function type or, if there is no such entity, the location of the
1930 /// type that will have function type.
1931 ///
1932 /// \param Entity The name of the entity that involves the function
1933 /// type, if known.
1934 ///
1935 /// \param EPI Extra information about the function type. Usually this will
1936 /// be taken from an existing function with the same prototype.
1937 ///
1938 /// \returns A suitable function type, if there are no errors. The
1939 /// unqualified type will always be a FunctionProtoType.
1940 /// Otherwise, returns a NULL type.
1942 MutableArrayRef<QualType> ParamTypes,
1943 SourceLocation Loc, DeclarationName Entity,
1945
1947 SourceLocation Loc,
1948 DeclarationName Entity);
1950 SourceLocation Loc, DeclarationName Entity);
1954 SourceLocation Loc);
1956 SourceLocation Loc);
1957 QualType BuildExtIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc);
1958
1961
1962 /// Package the given type and TSI into a ParsedType.
1967 TypeSourceInfo **TInfo = nullptr);
1968 CanThrowResult canThrow(const Stmt *E);
1969 /// Determine whether the callee of a particular function call can throw.
1970 /// E, D and Loc are all optional.
1971 static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D,
1974 const FunctionProtoType *FPT);
1981 const FunctionProtoType *Old, SourceLocation OldLoc,
1982 const FunctionProtoType *New, SourceLocation NewLoc);
1984 const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
1985 const FunctionProtoType *Old, SourceLocation OldLoc,
1986 const FunctionProtoType *New, SourceLocation NewLoc);
1987 bool handlerCanCatch(QualType HandlerType, QualType ExceptionType);
1989 const PartialDiagnostic &NestedDiagID,
1990 const PartialDiagnostic &NoteID,
1991 const PartialDiagnostic &NoThrowDiagID,
1992 const FunctionProtoType *Superset,
1993 SourceLocation SuperLoc,
1994 const FunctionProtoType *Subset,
1995 SourceLocation SubLoc);
1996 bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID,
1997 const PartialDiagnostic &NoteID,
1998 const FunctionProtoType *Target,
1999 SourceLocation TargetLoc,
2000 const FunctionProtoType *Source,
2001 SourceLocation SourceLoc);
2002
2004
2005 /// The parser has parsed the context-sensitive type 'instancetype'
2006 /// in an Objective-C message declaration. Return the appropriate type.
2008
2009 /// Abstract class used to diagnose incomplete types.
2012
2013 virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
2014 virtual ~TypeDiagnoser() {}
2015 };
2016
2017 static int getPrintable(int I) { return I; }
2018 static unsigned getPrintable(unsigned I) { return I; }
2019 static bool getPrintable(bool B) { return B; }
2020 static const char * getPrintable(const char *S) { return S; }
2021 static StringRef getPrintable(StringRef S) { return S; }
2022 static const std::string &getPrintable(const std::string &S) { return S; }
2023 static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
2024 return II;
2025 }
2027 static QualType getPrintable(QualType T) { return T; }
2028 static SourceRange getPrintable(SourceRange R) { return R; }
2030 static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
2032
2033 template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
2034 protected:
2035 unsigned DiagID;
2036 std::tuple<const Ts &...> Args;
2037
2038 template <std::size_t... Is>
2040 std::index_sequence<Is...>) const {
2041 // Apply all tuple elements to the builder in order.
2042 bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
2043 (void)Dummy;
2044 }
2045
2046 public:
2047 BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
2048 : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
2049 assert(DiagID != 0 && "no diagnostic for type diagnoser");
2050 }
2051
2052 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
2053 const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
2054 emit(DB, std::index_sequence_for<Ts...>());
2055 DB << T;
2056 }
2057 };
2058
2059 /// Do a check to make sure \p Name looks like a legal argument for the
2060 /// swift_name attribute applied to decl \p D. Raise a diagnostic if the name
2061 /// is invalid for the given declaration.
2062 ///
2063 /// \p AL is used to provide caret diagnostics in case of a malformed name.
2064 ///
2065 /// \returns true if the name is a valid swift name for \p D, false otherwise.
2066 bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc,
2067 const ParsedAttr &AL, bool IsAsync);
2068
2069 /// A derivative of BoundTypeDiagnoser for which the diagnostic's type
2070 /// parameter is preceded by a 0/1 enum that is 1 if the type is sizeless.
2071 /// For example, a diagnostic with no other parameters would generally have
2072 /// the form "...%select{incomplete|sizeless}0 type %1...".
2073 template <typename... Ts>
2075 public:
2076 SizelessTypeDiagnoser(unsigned DiagID, const Ts &... Args)
2077 : BoundTypeDiagnoser<Ts...>(DiagID, Args...) {}
2078
2079 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
2080 const SemaDiagnosticBuilder &DB = S.Diag(Loc, this->DiagID);
2081 this->emit(DB, std::index_sequence_for<Ts...>());
2082 DB << T->isSizelessType() << T;
2083 }
2084 };
2085
2086 enum class CompleteTypeKind {
2087 /// Apply the normal rules for complete types. In particular,
2088 /// treat all sizeless types as incomplete.
2089 Normal,
2090
2091 /// Relax the normal rules for complete types so that they include
2092 /// sizeless built-in types.
2094
2095 // FIXME: Eventually we should flip the default to Normal and opt in
2096 // to AcceptSizeless rather than opt out of it.
2098 };
2099
2100private:
2101 /// Methods for marking which expressions involve dereferencing a pointer
2102 /// marked with the 'noderef' attribute. Expressions are checked bottom up as
2103 /// they are parsed, meaning that a noderef pointer may not be accessed. For
2104 /// example, in `&*p` where `p` is a noderef pointer, we will first parse the
2105 /// `*p`, but need to check that `address of` is called on it. This requires
2106 /// keeping a container of all pending expressions and checking if the address
2107 /// of them are eventually taken.
2108 void CheckSubscriptAccessOfNoDeref(const ArraySubscriptExpr *E);
2109 void CheckAddressOfNoDeref(const Expr *E);
2110 void CheckMemberAccessOfNoDeref(const MemberExpr *E);
2111
2112 bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
2113 CompleteTypeKind Kind, TypeDiagnoser *Diagnoser);
2114
2115 struct ModuleScope {
2116 SourceLocation BeginLoc;
2117 clang::Module *Module = nullptr;
2118 bool ModuleInterface = false;
2119 bool ImplicitGlobalModuleFragment = false;
2120 VisibleModuleSet OuterVisibleModules;
2121 };
2122 /// The modules we're currently parsing.
2124
2125 /// Namespace definitions that we will export when they finish.
2126 llvm::SmallPtrSet<const NamespaceDecl*, 8> DeferredExportedNamespaces;
2127
2128 /// Get the module whose scope we are currently within.
2129 Module *getCurrentModule() const {
2130 return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
2131 }
2132
2133 VisibleModuleSet VisibleModules;
2134
2135public:
2136 /// Get the module owning an entity.
2137 Module *getOwningModule(const Decl *Entity) {
2138 return Entity->getOwningModule();
2139 }
2140
2141 /// Make a merged definition of an existing hidden definition \p ND
2142 /// visible at the specified location.
2144
2145 bool isModuleVisible(const Module *M, bool ModulePrivate = false);
2146
2147 // When loading a non-modular PCH files, this is used to restore module
2148 // visibility.
2150 VisibleModules.setVisible(Mod, ImportLoc);
2151 }
2152
2153 /// Determine whether a declaration is visible to name lookup.
2154 bool isVisible(const NamedDecl *D) {
2155 return D->isUnconditionallyVisible() || isVisibleSlow(D);
2156 }
2157
2158 /// Determine whether any declaration of an entity is visible.
2159 bool
2161 llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
2162 return isVisible(D) || hasVisibleDeclarationSlow(D, Modules);
2163 }
2166
2169
2170 /// Determine if \p D and \p Suggested have a structurally compatible
2171 /// layout as described in C11 6.2.7/1.
2172 bool hasStructuralCompatLayout(Decl *D, Decl *Suggested);
2173
2174 /// Determine if \p D has a visible definition. If not, suggest a declaration
2175 /// that should be made visible to expose the definition.
2176 bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
2177 bool OnlyNeedComplete = false);
2179 NamedDecl *Hidden;
2180 return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden);
2181 }
2182
2183 /// Determine if the template parameter \p D has a visible default argument.
2184 bool
2186 llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2187
2188 /// Determine if there is a visible declaration of \p D that is an explicit
2189 /// specialization declaration for a specialization of a template. (For a
2190 /// member specialization, use hasVisibleMemberSpecialization.)
2192 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2193
2194 /// Determine if there is a visible declaration of \p D that is a member
2195 /// specialization declaration (as opposed to an instantiated declaration).
2197 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2198
2199 /// Determine if \p A and \p B are equivalent internal linkage declarations
2200 /// from different modules, and thus an ambiguity error can be downgraded to
2201 /// an extension warning.
2203 const NamedDecl *B);
2205 SourceLocation Loc, const NamedDecl *D,
2207
2209
2212 return !RequireCompleteTypeImpl(Loc, T, Kind, nullptr);
2213 }
2215 CompleteTypeKind Kind, TypeDiagnoser &Diagnoser);
2217 CompleteTypeKind Kind, unsigned DiagID);
2218
2220 TypeDiagnoser &Diagnoser) {
2221 return RequireCompleteType(Loc, T, CompleteTypeKind::Default, Diagnoser);
2222 }
2223 bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID) {
2224 return RequireCompleteType(Loc, T, CompleteTypeKind::Default, DiagID);
2225 }
2226
2227 template <typename... Ts>
2228 bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
2229 const Ts &...Args) {
2230 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2231 return RequireCompleteType(Loc, T, Diagnoser);
2232 }
2233
2234 template <typename... Ts>
2236 const Ts &... Args) {
2237 SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2238 return RequireCompleteType(Loc, T, CompleteTypeKind::Normal, Diagnoser);
2239 }
2240
2241 /// Get the type of expression E, triggering instantiation to complete the
2242 /// type if necessary -- that is, if the expression refers to a templated
2243 /// static data member of incomplete array type.
2244 ///
2245 /// May still return an incomplete type if instantiation was not possible or
2246 /// if the type is incomplete for a different reason. Use
2247 /// RequireCompleteExprType instead if a diagnostic is expected for an
2248 /// incomplete expression type.
2250
2253 TypeDiagnoser &Diagnoser);
2254 bool RequireCompleteExprType(Expr *E, unsigned DiagID);
2255
2256 template <typename... Ts>
2257 bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
2258 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2260 }
2261
2262 template <typename... Ts>
2263 bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID,
2264 const Ts &... Args) {
2265 SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2267 }
2268
2270 TypeDiagnoser &Diagnoser);
2271 bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
2272
2273 template <typename... Ts>
2274 bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
2275 const Ts &...Args) {
2276 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2277 return RequireLiteralType(Loc, T, Diagnoser);
2278 }
2279
2281 const CXXScopeSpec &SS, QualType T,
2282 TagDecl *OwnedTagDecl = nullptr);
2283
2285 /// If AsUnevaluated is false, E is treated as though it were an evaluated
2286 /// context, such as when building a type for decltype(auto).
2288 bool AsUnevaluated = true);
2291 SourceLocation Loc);
2292
2293 //===--------------------------------------------------------------------===//
2294 // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
2295 //
2296
2306
2307 DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
2308
2310
2311 bool isSimpleTypeSpecifier(tok::TokenKind Kind) const;
2312
2314 Scope *S, CXXScopeSpec *SS = nullptr,
2315 bool isClassName = false, bool HasTrailingDot = false,
2316 ParsedType ObjectType = nullptr,
2317 bool IsCtorOrDtorName = false,
2318 bool WantNontrivialTypeSourceInfo = false,
2319 bool IsClassTemplateDeductionContext = true,
2320 IdentifierInfo **CorrectedII = nullptr);
2322 bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
2324 SourceLocation IILoc,
2325 Scope *S,
2326 CXXScopeSpec *SS,
2327 ParsedType &SuggestedType,
2328 bool IsTemplateName = false);
2329
2330 /// Attempt to behave like MSVC in situations where lookup of an unqualified
2331 /// type name has failed in a dependent context. In these situations, we
2332 /// automatically form a DependentTypeName that will retry lookup in a related
2333 /// scope during instantiation.
2335 SourceLocation NameLoc,
2336 bool IsTemplateTypeArg);
2337
2338 /// Describes the result of the name lookup and resolution performed
2339 /// by \c ClassifyName().
2341 /// This name is not a type or template in this context, but might be
2342 /// something else.
2344 /// Classification failed; an error has been produced.
2346 /// The name has been typo-corrected to a keyword.
2348 /// The name was classified as a type.
2350 /// The name was classified as a specific non-type, non-template
2351 /// declaration. ActOnNameClassifiedAsNonType should be called to
2352 /// convert the declaration to an expression.
2354 /// The name was classified as an ADL-only function name.
2355 /// ActOnNameClassifiedAsUndeclaredNonType should be called to convert the
2356 /// result to an expression.
2358 /// The name denotes a member of a dependent type that could not be
2359 /// resolved. ActOnNameClassifiedAsDependentNonType should be called to
2360 /// convert the result to an expression.
2362 /// The name was classified as an overload set, and an expression
2363 /// representing that overload set has been formed.
2364 /// ActOnNameClassifiedAsOverloadSet should be called to form a suitable
2365 /// expression referencing the overload set.
2367 /// The name was classified as a template whose specializations are types.
2369 /// The name was classified as a variable template name.
2371 /// The name was classified as a function template name.
2373 /// The name was classified as an ADL-only function template name.
2375 /// The name was classified as a concept name.
2377 };
2378
2381 union {
2386 };
2387
2388 explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
2389
2390 public:
2392
2394
2397 }
2398
2402
2405 Result.Expr = E;
2406 return Result;
2407 }
2408
2411 Result.NonTypeDecl = D;
2412 return Result;
2413 }
2414
2418
2422
2425 Result.Template = Name;
2426 return Result;
2427 }
2428
2431 Result.Template = Name;
2432 return Result;
2433 }
2434
2437 Result.Template = Name;
2438 return Result;
2439 }
2440
2443 Result.Template = Name;
2444 return Result;
2445 }
2446
2452
2453 NameClassificationKind getKind() const { return Kind; }
2454
2456 assert(Kind == NC_OverloadSet);
2457 return Expr;
2458 }
2459
2461 assert(Kind == NC_Type);
2462 return Type;
2463 }
2464
2466 assert(Kind == NC_NonType);
2467 return NonTypeDecl;
2468 }
2469
2471 assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
2472 Kind == NC_VarTemplate || Kind == NC_Concept ||
2473 Kind == NC_UndeclaredTemplate);
2474 return Template;
2475 }
2476
2478 switch (Kind) {
2479 case NC_TypeTemplate:
2480 return TNK_Type_template;
2482 return TNK_Function_template;
2483 case NC_VarTemplate:
2484 return TNK_Var_template;
2485 case NC_Concept:
2486 return TNK_Concept_template;
2489 default:
2490 llvm_unreachable("unsupported name classification.");
2491 }
2492 }
2493 };
2494
2495 /// Perform name lookup on the given name, classifying it based on
2496 /// the results of name lookup and the following token.
2497 ///
2498 /// This routine is used by the parser to resolve identifiers and help direct
2499 /// parsing. When the identifier cannot be found, this routine will attempt
2500 /// to correct the typo and classify based on the resulting name.
2501 ///
2502 /// \param S The scope in which we're performing name lookup.
2503 ///
2504 /// \param SS The nested-name-specifier that precedes the name.
2505 ///
2506 /// \param Name The identifier. If typo correction finds an alternative name,
2507 /// this pointer parameter will be updated accordingly.
2508 ///
2509 /// \param NameLoc The location of the identifier.
2510 ///
2511 /// \param NextToken The token following the identifier. Used to help
2512 /// disambiguate the name.
2513 ///
2514 /// \param CCC The correction callback, if typo correction is desired.
2515 NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS,
2516 IdentifierInfo *&Name, SourceLocation NameLoc,
2517 const Token &NextToken,
2518 CorrectionCandidateCallback *CCC = nullptr);
2519
2520 /// Act on the result of classifying a name as an undeclared (ADL-only)
2521 /// non-type declaration.
2523 SourceLocation NameLoc);
2524 /// Act on the result of classifying a name as an undeclared member of a
2525 /// dependent base class.
2527 IdentifierInfo *Name,
2528 SourceLocation NameLoc,
2529 bool IsAddressOfOperand);
2530 /// Act on the result of classifying a name as a specific non-type
2531 /// declaration.
2533 NamedDecl *Found,
2534 SourceLocation NameLoc,
2535 const Token &NextToken);
2536 /// Act on the result of classifying a name as an overload set.
2538
2539 /// Describes the detailed kind of a template name. Used in diagnostics.
2551
2552 /// Determine whether it's plausible that E was intended to be a
2553 /// template-name.
2555 if (!getLangOpts().CPlusPlus || E.isInvalid())
2556 return false;
2557 Dependent = false;
2558 if (auto *DRE = dyn_cast<DeclRefExpr>(E.get()))
2559 return !DRE->hasExplicitTemplateArgs();
2560 if (auto *ME = dyn_cast<MemberExpr>(E.get()))
2561 return !ME->hasExplicitTemplateArgs();
2562 Dependent = true;
2563 if (auto *DSDRE = dyn_cast<DependentScopeDeclRefExpr>(E.get()))
2564 return !DSDRE->hasExplicitTemplateArgs();
2565 if (auto *DSME = dyn_cast<CXXDependentScopeMemberExpr>(E.get()))
2566 return !DSME->hasExplicitTemplateArgs();
2567 // Any additional cases recognized here should also be handled by
2568 // diagnoseExprIntendedAsTemplateName.
2569 return false;
2570 }
2574
2576
2578 MultiTemplateParamsArg TemplateParameterLists);
2583 bool IsTemplateId);
2584 void
2585 diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
2586 SourceLocation FallbackLoc,
2587 SourceLocation ConstQualLoc = SourceLocation(),
2588 SourceLocation VolatileQualLoc = SourceLocation(),
2589 SourceLocation RestrictQualLoc = SourceLocation(),
2590 SourceLocation AtomicQualLoc = SourceLocation(),
2591 SourceLocation UnalignedQualLoc = SourceLocation());
2592
2594 void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
2596 const LookupResult &R);
2598 void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
2599 const LookupResult &R);
2600 void CheckShadow(Scope *S, VarDecl *D);
2601
2602 /// Warn if 'E', which is an expression that is about to be modified, refers
2603 /// to a shadowing declaration.
2605
2607
2608private:
2609 /// Map of current shadowing declarations to shadowed declarations. Warn if
2610 /// it looks like the user is trying to modify the shadowing declaration.
2611 llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
2612
2613public:
2614 void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
2615 void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
2616 void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
2617 TypedefNameDecl *NewTD);
2620 TypeSourceInfo *TInfo,
2623 LookupResult &Previous, bool &Redeclaration);
2625 TypeSourceInfo *TInfo,
2627 MultiTemplateParamsArg TemplateParamLists,
2628 bool &AddToScope,
2629 ArrayRef<BindingDecl *> Bindings = None);
2630 NamedDecl *
2632 MultiTemplateParamsArg TemplateParamLists);
2633 // Returns true if the variable declaration is a redeclaration
2637 Expr *Init);
2641
2643 TypeSourceInfo *TInfo,
2645 MultiTemplateParamsArg TemplateParamLists,
2646 bool &AddToScope);
2648
2650 /// Diagnose issues that are non-constant or that are extensions.
2651 Diagnose,
2652 /// Identify whether this function satisfies the formal rules for constexpr
2653 /// functions in the current lanugage mode (with no extensions).
2655 };
2656
2658 CheckConstexprKind Kind);
2659
2662 SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
2664 SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
2665 // Returns true if the function declaration is a redeclaration
2668 bool IsMemberSpecialization);
2671 QualType NewT, QualType OldT);
2672 void CheckMain(FunctionDecl *FD, const DeclSpec &D);
2675 bool IsDefinition);
2679 SourceLocation Loc,
2680 QualType T);
2682 SourceLocation NameLoc, IdentifierInfo *Name,
2683 QualType T, TypeSourceInfo *TSInfo,
2684 StorageClass SC);
2685 void ActOnParamDefaultArgument(Decl *param,
2686 SourceLocation EqualLoc,
2687 Expr *defarg);
2689 SourceLocation ArgLoc);
2690 void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc);
2692 Expr *DefaultArg,
2693 SourceLocation EqualLoc);
2694 void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
2695 SourceLocation EqualLoc);
2696
2697 // Contexts where using non-trivial C union types can be disallowed. This is
2698 // passed to err_non_trivial_c_union_in_invalid_context.
2700 // Function parameter.
2702 // Function return.
2704 // Default-initialized object.
2706 // Variable with automatic storage duration.
2708 // Initializer expression that might copy from another object.
2710 // Assignment.
2712 // Compound literal.
2714 // Block capture.
2716 // lvalue-to-rvalue conversion of volatile type.
2718 };
2719
2720 /// Emit diagnostics if the initializer or any of its explicit or
2721 /// implicitly-generated subexpressions require copying or
2722 /// default-initializing a type that is or contains a C union type that is
2723 /// non-trivial to copy or default-initialize.
2725
2726 // These flags are passed to checkNonTrivialCUnion.
2732
2733 /// Emit diagnostics if a non-trivial C union type or a struct that contains
2734 /// a non-trivial C union is used in an invalid context.
2736 NonTrivialCUnionContext UseContext,
2737 unsigned NonTrivialKind);
2738
2739 void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
2740 void ActOnUninitializedDecl(Decl *dcl);
2741 void ActOnInitializerError(Decl *Dcl);
2742
2743 void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
2744 void ActOnCXXForRangeDecl(Decl *D);
2746 IdentifierInfo *Ident,
2747 ParsedAttributes &Attrs,
2748 SourceLocation AttrEnd);
2749 void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
2750 void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
2752 void FinalizeDeclaration(Decl *D);
2754 ArrayRef<Decl *> Group);
2756
2757 /// Should be called on all declarations that might have attached
2758 /// documentation comments.
2759 void ActOnDocumentableDecl(Decl *D);
2761
2763 SourceLocation LocAfterDecls);
2765 FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
2766 SkipBodyInfo *SkipBody = nullptr);
2768 MultiTemplateParamsArg TemplateParamLists,
2769 SkipBodyInfo *SkipBody = nullptr);
2771 SkipBodyInfo *SkipBody = nullptr);
2777 return D && isa<ObjCMethodDecl>(D);
2778 }
2779
2780 /// Determine whether we can delay parsing the body of a function or
2781 /// function template until it is used, assuming we don't care about emitting
2782 /// code for that function.
2783 ///
2784 /// This will be \c false if we may need the body of the function in the
2785 /// middle of parsing an expression (where it's impractical to switch to
2786 /// parsing a different function), for instance, if it's constexpr in C++11
2787 /// or has an 'auto' return type in C++14. These cases are essentially bugs.
2788 bool canDelayFunctionBody(const Declarator &D);
2789
2790 /// Determine whether we can skip parsing the body of a function
2791 /// definition, assuming we don't care about analyzing its body or emitting
2792 /// code for that function.
2793 ///
2794 /// This will be \c false only if we may need the body of the function in
2795 /// order to parse the rest of the program (for instance, if it is
2796 /// \c constexpr in C++11 or has an 'auto' return type in C++14).
2797 bool canSkipFunctionBody(Decl *D);
2798
2801 Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
2804
2805 /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
2806 /// attribute for which parsing is delayed.
2808
2809 /// Diagnose any unused parameters in the given sequence of
2810 /// ParmVarDecl pointers.
2812
2813 /// Diagnose whether the size of parameters or return value of a
2814 /// function or obj-c method definition is pass-by-value and larger than a
2815 /// specified threshold.
2816 void
2818 QualType ReturnTy, NamedDecl *D);
2819
2820 void DiagnoseInvalidJumps(Stmt *Body);
2822 SourceLocation AsmLoc,
2823 SourceLocation RParenLoc);
2824
2825 /// Handle a C++11 empty-declaration and attribute-declaration.
2827 SourceLocation SemiLoc);
2828
2829 enum class ModuleDeclKind {
2830 Interface, ///< 'export module X;'
2831 Implementation, ///< 'module X;'
2832 };
2833
2834 /// The parser has processed a module-declaration that begins the definition
2835 /// of a module interface or implementation.
2837 SourceLocation ModuleLoc, ModuleDeclKind MDK,
2838 ModuleIdPath Path, bool IsFirstDecl);
2839
2840 /// The parser has processed a global-module-fragment declaration that begins
2841 /// the definition of the global module fragment of the current module unit.
2842 /// \param ModuleLoc The location of the 'module' keyword.
2844
2845 /// The parser has processed a private-module-fragment declaration that begins
2846 /// the definition of the private module fragment of the current module unit.
2847 /// \param ModuleLoc The location of the 'module' keyword.
2848 /// \param PrivateLoc The location of the 'private' keyword.
2850 SourceLocation PrivateLoc);
2851
2852 /// The parser has processed a module import declaration.
2853 ///
2854 /// \param StartLoc The location of the first token in the declaration. This
2855 /// could be the location of an '@', 'export', or 'import'.
2856 /// \param ExportLoc The location of the 'export' keyword, if any.
2857 /// \param ImportLoc The location of the 'import' keyword.
2858 /// \param Path The module access path.
2860 SourceLocation ExportLoc,
2861 SourceLocation ImportLoc, ModuleIdPath Path);
2863 SourceLocation ExportLoc,
2864 SourceLocation ImportLoc, Module *M,
2865 ModuleIdPath Path = {});
2866
2867 /// The parser has processed a module import translated from a
2868 /// #include or similar preprocessing directive.
2869 void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
2870 void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
2871
2872 /// The parsed has entered a submodule.
2873 void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
2874 /// The parser has left a submodule.
2875 void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
2876
2877 /// Create an implicit import of the given module at the given
2878 /// source location, for error recovery, if possible.
2879 ///
2880 /// This routine is typically used when an entity found by name lookup
2881 /// is actually hidden within a module that we know about but the user
2882 /// has forgotten to import.
2883 void createImplicitModuleImportForErrorRecovery(SourceLocation Loc,
2884 Module *Mod);
2885
2886 /// Kinds of missing import. Note, the values of these enumerators correspond
2887 /// to %select values in diagnostics.
2895
2896 /// Diagnose that the specified declaration needs to be visible but
2897 /// isn't, and suggest a module import that would resolve the problem.
2899 MissingImportKind MIK, bool Recover = true);
2901 SourceLocation DeclLoc, ArrayRef<Module *> Modules,
2902 MissingImportKind MIK, bool Recover);
2903
2905 SourceLocation LBraceLoc);
2907 SourceLocation RBraceLoc);
2908
2909 /// We've found a use of a templated declaration that would trigger an
2910 /// implicit instantiation. Check that any relevant explicit specializations
2911 /// and partial specializations are visible, and diagnose if not.
2913
2914 /// Retrieve a suitable printing policy for diagnostics.
2918
2919 /// Retrieve a suitable printing policy for diagnostics.
2921 const Preprocessor &PP);
2922
2923 /// Scope actions.
2924 void ActOnPopScope(SourceLocation Loc, Scope *S);
2926
2928 RecordDecl *&AnonRecord);
2930 MultiTemplateParamsArg TemplateParams,
2931 bool IsExplicitInstantiation,
2932 RecordDecl *&AnonRecord);
2933
2935 AccessSpecifier AS,
2936 RecordDecl *Record,
2937 const PrintingPolicy &Policy);
2938
2940 RecordDecl *Record);
2941
2942 /// Common ways to introduce type names without a tag for use in diagnostics.
2943 /// Keep in sync with err_tag_reference_non_tag.
2955
2956 /// Given a non-tag type declaration, returns an enum useful for indicating
2957 /// what kind of non-tag type this is.
2959
2961 TagTypeKind NewTag, bool isDefinition,
2962 SourceLocation NewTagLoc,
2963 const IdentifierInfo *Name);
2964
2966 TUK_Reference, // Reference to a tag: 'struct foo *X;'
2967 TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
2968 TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
2969 TUK_Friend // Friend declaration: 'friend struct foo;'
2971
2972 Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
2973 SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name,
2975 AccessSpecifier AS, SourceLocation ModulePrivateLoc,
2976 MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl,
2977 bool &IsDependent, SourceLocation ScopedEnumKWLoc,
2978 bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
2979 bool IsTypeSpecifier, bool IsTemplateParamOrArg,
2980 SkipBodyInfo *SkipBody = nullptr);
2981
2983 unsigned TagSpec, SourceLocation TagLoc,
2984 CXXScopeSpec &SS, IdentifierInfo *Name,
2985 SourceLocation NameLoc,
2987 MultiTemplateParamsArg TempParamLists);
2988
2990 unsigned TagSpec,
2991 TagUseKind TUK,
2992 const CXXScopeSpec &SS,
2993 IdentifierInfo *Name,
2994 SourceLocation TagLoc,
2995 SourceLocation NameLoc);
2996
2997 void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
2998 IdentifierInfo *ClassName,
3000 Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
3001 Declarator &D, Expr *BitfieldWidth);
3002
3003 FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
3004 Declarator &D, Expr *BitfieldWidth,
3005 InClassInitStyle InitStyle,
3006 AccessSpecifier AS);
3008 SourceLocation DeclStart, Declarator &D,
3009 Expr *BitfieldWidth,
3010 InClassInitStyle InitStyle,
3011 AccessSpecifier AS,
3012 const ParsedAttr &MSPropertyAttr);
3013
3015 TypeSourceInfo *TInfo,
3016 RecordDecl *Record, SourceLocation Loc,
3017 bool Mutable, Expr *BitfieldWidth,
3018 InClassInitStyle InitStyle,
3019 SourceLocation TSSL,
3020 AccessSpecifier AS, NamedDecl *PrevDecl,
3021 Declarator *D = nullptr);
3022
3024 void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM);
3025
3027 /// The triviality of a method unaffected by "trivial_abi".
3029
3030 /// The triviality of a method affected by "trivial_abi".
3033
3034 bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
3036 bool Diagnose = false);
3037
3038 /// For a defaulted function, the kind of defaulted function that it is.
3040 CXXSpecialMember SpecialMember : 8;
3041 DefaultedComparisonKind Comparison : 8;
3042
3043 public:
3045 : SpecialMember(CXXInvalid), Comparison(DefaultedComparisonKind::None) {
3046 }
3048 : SpecialMember(CSM), Comparison(DefaultedComparisonKind::None) {}
3050 : SpecialMember(CXXInvalid), Comparison(Comp) {}
3051
3052 bool isSpecialMember() const { return SpecialMember != CXXInvalid; }
3053 bool isComparison() const {
3054 return Comparison != DefaultedComparisonKind::None;
3055 }
3056
3057 explicit operator bool() const {
3058 return isSpecialMember() || isComparison();
3059 }
3060
3061 CXXSpecialMember asSpecialMember() const { return SpecialMember; }
3062 DefaultedComparisonKind asComparison() const { return Comparison; }
3063
3064 /// Get the index of this function kind for use in diagnostics.
3065 unsigned getDiagnosticIndex() const {
3066 static_assert(CXXInvalid > CXXDestructor,
3067 "invalid should have highest index");
3068 static_assert((unsigned)DefaultedComparisonKind::None == 0,
3069 "none should be equal to zero");
3070 return SpecialMember + (unsigned)Comparison;
3071 }
3072 };
3073
3074 DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD);
3075
3082
3083 void ActOnLastBitfield(SourceLocation DeclStart,
3084 SmallVectorImpl<Decl *> &AllIvarDecls);
3085 Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
3086 Declarator &D, Expr *BitfieldWidth,
3087 tok::ObjCKeywordKind visibility);
3088
3089 // This is used for both record definitions and ObjC interface declarations.
3090 void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl,
3091 ArrayRef<Decl *> Fields, SourceLocation LBrac,
3092 SourceLocation RBrac, const ParsedAttributesView &AttrList);
3093
3094 /// ActOnTagStartDefinition - Invoked when we have entered the
3095 /// scope of a tag's definition (e.g., for an enumeration, class,
3096 /// struct, or union).
3098
3099 /// Perform ODR-like check for C/ObjC when merging tag types from modules.
3100 /// Differently from C++, actually parse the body and reject / error out
3101 /// in case of a structural mismatch.
3102 bool ActOnDuplicateDefinition(DeclSpec &DS, Decl *Prev,
3103 SkipBodyInfo &SkipBody);
3104
3106
3107 /// Invoked when we enter a tag definition that we're skipping.
3109
3111
3112 /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
3113 /// C++ record definition's base-specifiers clause and are starting its
3114 /// member declarations.
3116 SourceLocation FinalLoc,
3117 bool IsFinalSpelledSealed,
3118 SourceLocation LBraceLoc);
3119
3120 /// ActOnTagFinishDefinition - Invoked once we have finished parsing
3121 /// the definition of a tag (enumeration, class, struct, or union).
3123 SourceRange BraceRange);
3124
3126
3128
3129 /// Invoked when we must temporarily exit the objective-c container
3130 /// scope for parsing/looking-up C constructs.
3131 ///
3132 /// Must be followed by a call to \see ActOnObjCReenterContainerContext
3135
3136 /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
3137 /// error parsing the definition of a tag.
3139
3141 EnumConstantDecl *LastEnumConst,
3142 SourceLocation IdLoc,
3144 Expr *val);
3146 bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
3147 QualType EnumUnderlyingTy, bool IsFixed,
3148 const EnumDecl *Prev);
3149
3150 /// Determine whether the body of an anonymous enumeration should be skipped.
3151 /// \param II The name of the first enumerator.
3153 SourceLocation IILoc);
3154
3155 Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
3157 const ParsedAttributesView &Attrs,
3158 SourceLocation EqualLoc, Expr *Val);
3159 void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange,
3160 Decl *EnumDecl, ArrayRef<Decl *> Elements, Scope *S,
3161 const ParsedAttributesView &Attr);
3162
3163 /// Set the current declaration context until it gets popped.
3164 void PushDeclContext(Scope *S, DeclContext *DC);
3165 void PopDeclContext();
3166
3167 /// EnterDeclaratorContext - Used when we must lookup names in the context
3168 /// of a declarator's nested name specifier.
3171
3172 /// Enter a template parameter scope, after it's been associated with a particular
3173 /// DeclContext. Causes lookup within the scope to chain through enclosing contexts
3174 /// in the correct order.
3176
3177 /// Push the parameters of D, which must be a function, into scope.
3180
3182
3183 /// getCurFunctionDecl - If inside of a function body, this returns a pointer
3184 /// to the function decl for the function being parsed. If we're currently
3185 /// in a 'block', this returns the containing context.
3187
3188 /// getCurMethodDecl - If inside of a method body, this returns a pointer to
3189 /// the method decl for the method being parsed. If we're currently
3190 /// in a 'block', this returns the containing context.
3192
3193 /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
3194 /// or C function we're in, otherwise return null. If we're currently
3195 /// in a 'block', this returns the containing context.
3197
3198 /// Add this decl to the scope shadowed decl chains.
3199 void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
3200
3201 /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
3202 /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
3203 /// true if 'D' belongs to the given declaration context.
3204 ///
3205 /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
3206 /// enclosing namespace set of the context, rather than contained
3207 /// directly within it.
3208 bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
3209 bool AllowInlineNamespace = false);
3210
3211 /// Finds the scope corresponding to the given decl context, if it
3212 /// happens to be an enclosing scope. Otherwise return NULL.
3214
3215 /// Subroutines of ActOnDeclarator().
3217 TypeSourceInfo *TInfo);
3219
3220 /// Describes the kind of merge to perform for availability
3221 /// attributes (including "deprecated", "unavailable", and "availability").
3223 /// Don't merge availability attributes at all.
3225 /// Merge availability attributes for a redeclaration, which requires
3226 /// an exact match.
3228 /// Merge availability attributes for an override, which requires
3229 /// an exact match or a weakening of constraints.
3231 /// Merge availability attributes for an implementation of
3232 /// a protocol requirement.
3234 };
3235
3236 /// Describes the kind of priority given to an availability attribute.
3237 ///
3238 /// The sum of priorities deteremines the final priority of the attribute.
3239 /// The final priority determines how the attribute will be merged.
3240 /// An attribute with a lower priority will always remove higher priority
3241 /// attributes for the specified platform when it is being applied. An
3242 /// attribute with a higher priority will not be applied if the declaration
3243 /// already has an availability attribute with a lower priority for the
3244 /// specified platform. The final prirority values are not expected to match
3245 /// the values in this enumeration, but instead should be treated as a plain
3246 /// integer value. This enumeration just names the priority weights that are
3247 /// used to calculate that final vaue.
3249 /// The availability attribute was specified explicitly next to the
3250 /// declaration.
3252
3253 /// The availability attribute was applied using '#pragma clang attribute'.
3255
3256 /// The availability attribute for a specific platform was inferred from
3257 /// an availability attribute for another platform.
3260
3261 /// Attribute merging methods. Return true if a new attribute was added.
3264 IdentifierInfo *Platform, bool Implicit,
3265 VersionTuple Introduced, VersionTuple Deprecated,
3266 VersionTuple Obsoleted, bool IsUnavailable,
3267 StringRef Message, bool IsStrict, StringRef Replacement,
3268 AvailabilityMergeKind AMK, int Priority);
3275 StringRef UuidAsWritten, MSGuidDecl *GuidDecl);
3279 const AttributeCommonInfo &CI,
3280 bool BestCase,
3281 MSInheritanceModel Model);
3283 IdentifierInfo *Format, int FormatIdx,
3284 int FirstArg);
3286 StringRef Name);
3288 StringRef Name);
3290 const AttributeCommonInfo &CI,
3291 const IdentifierInfo *Ident);
3300 StringRef Name);
3302 const AttributeCommonInfo &CI);
3305 const InternalLinkageAttr &AL);
3309 Decl *D, const WebAssemblyImportNameAttr &AL);
3311 Decl *D, const WebAssemblyImportModuleAttr &AL);
3314 const EnforceTCBLeafAttr &AL);
3315
3316 void mergeDeclAttributes(NamedDecl *New, Decl *Old,
3319 LookupResult &OldDecls);
3320 bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
3321 bool MergeTypeWithOld);
3323 Scope *S, bool MergeTypeWithOld);
3326 void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
3328 bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
3329 void notePreviousDefinition(const NamedDecl *Old, SourceLocation New);
3331
3332 // AssignmentAction - This is used by all the assignment diagnostic functions
3333 // to represent what is actually causing the operation
3344
3345 /// C++ Overloading.
3347 /// This is a legitimate overload: the existing declarations are
3348 /// functions or function templates with different signatures.
3350
3351 /// This is not an overload because the signature exactly matches
3352 /// an existing declaration.
3354
3355 /// This is not an overload because the lookup results contain a
3356 /// non-function.
3360 FunctionDecl *New,
3361 const LookupResult &OldDecls,
3362 NamedDecl *&OldDecl,
3363 bool IsForUsingDecl);
3364 bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl,
3365 bool ConsiderCudaAttrs = true,
3366 bool ConsiderRequiresClauses = true);
3367
3368 enum class AllowedExplicit {
3369 /// Allow no explicit functions to be used.
3370 None,
3371 /// Allow explicit conversion functions but not explicit constructors.
3373 /// Allow both explicit conversion functions and explicit constructors.
3374 All
3375 };
3376
3378 TryImplicitConversion(Expr *From, QualType ToType,
3379 bool SuppressUserConversions,
3380 AllowedExplicit AllowExplicit,
3381 bool InOverloadResolution,
3382 bool CStyle,
3383 bool AllowObjCWritebackConversion);
3384
3385 bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
3386 bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
3387 bool IsComplexPromotion(QualType FromType, QualType ToType);
3388 bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
3389 bool InOverloadResolution,
3390 QualType& ConvertedType, bool &IncompatibleObjC);
3391 bool isObjCPointerConversion(QualType FromType, QualType ToType,
3392 QualType& ConvertedType, bool &IncompatibleObjC);
3393 bool isObjCWritebackConversion(QualType FromType, QualType ToType,
3394 QualType &ConvertedType);
3395 bool IsBlockPointerConversion(QualType FromType, QualType ToType,
3396 QualType& ConvertedType);
3398 const FunctionProtoType *NewType,
3399 unsigned *ArgPos = nullptr);
3401 QualType FromType, QualType ToType);
3402
3405 bool CheckPointerConversion(Expr *From, QualType ToType,
3406 CastKind &Kind,
3407 CXXCastPath& BasePath,
3408 bool IgnoreBaseAccess,
3409 bool Diagnose = true);
3410 bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
3411 bool InOverloadResolution,
3412 QualType &ConvertedType);
3413 bool CheckMemberPointerConversion(Expr *From, QualType ToType,
3414 CastKind &Kind,
3415 CXXCastPath &BasePath,
3416 bool IgnoreBaseAccess);
3417 bool IsQualificationConversion(QualType FromType, QualType ToType,
3418 bool CStyle, bool &ObjCLifetimeConversion);
3419 bool IsFunctionConversion(QualType FromType, QualType ToType,
3420 QualType &ResultTy);
3423
3425 const VarDecl *NRVOCandidate,
3426 QualType ResultType,
3427 Expr *Value,
3428 bool AllowNRVO = true);
3429
3431 const InitializedEntity &Entity, InitListExpr *From);
3432
3433 bool IsStringInit(Expr *Init, const ArrayType *AT);
3434
3436 ExprResult Init);
3438 SourceLocation EqualLoc,
3439 ExprResult Init,
3440 bool TopLevelOfInitList = false,
3441 bool AllowExplicit = false);
3443 NestedNameSpecifier *Qualifier,
3444 NamedDecl *FoundDecl,
3445 CXXMethodDecl *Method);
3446
3447 /// Check that the lifetime of the initializer (and its subobjects) is
3448 /// sufficient for initializing the entity, and perform lifetime extension
3449 /// (when permitted) if not.
3450 void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init);
3451
3454
3455 /// Contexts in which a converted constant expression is required.
3456 enum CCEKind {
3457 CCEK_CaseValue, ///< Expression in a case label.
3458 CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
3459 CCEK_TemplateArg, ///< Value of a non-type template parameter.
3460 CCEK_ArrayBound, ///< Array bound in array declarator or new-expression.
3461 CCEK_ConstexprIf, ///< Condition in a constexpr if statement.
3462 CCEK_ExplicitBool ///< Condition in an explicit(bool) specifier.
3465 llvm::APSInt &Value, CCEKind CCE);
3467 APValue &Value, CCEKind CCE,
3468 NamedDecl *Dest = nullptr);
3469
3470 /// Abstract base class used to perform a contextual implicit
3471 /// conversion from an expression to any type passing a filter.
3473 public:
3476
3480
3481 /// Determine whether the specified type is a valid destination type
3482 /// for this conversion.
3483 virtual bool match(QualType T) = 0;
3484
3485 /// Emits a diagnostic complaining that the expression does not have
3486 /// integral or enumeration type.
3487 virtual SemaDiagnosticBuilder
3489
3490 /// Emits a diagnostic when the expression has incomplete class type.
3491 virtual SemaDiagnosticBuilder
3493
3494 /// Emits a diagnostic when the only matching conversion function
3495 /// is explicit.
3497 Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
3498
3499 /// Emits a note for the explicit conversion function.
3500 virtual SemaDiagnosticBuilder
3502
3503 /// Emits a diagnostic when there are multiple possible conversion
3504 /// functions.
3505 virtual SemaDiagnosticBuilder
3507
3508 /// Emits a note for one of the candidate conversions.
3509 virtual SemaDiagnosticBuilder
3511
3512 /// Emits a diagnostic when we picked a conversion function
3513 /// (for cases when we are not allowed to pick a conversion function).
3515 Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
3516
3518 };
3519
3521 bool AllowScopedEnumerations;
3522
3523 public:
3524 ICEConvertDiagnoser(bool AllowScopedEnumerations,
3525 bool Suppress, bool SuppressConversion)
3527 AllowScopedEnumerations(AllowScopedEnumerations) {}
3528
3529 /// Match an integral or (possibly scoped) enumeration type.
3530 bool match(QualType T) override;
3531
3534 return diagnoseNotInt(S, Loc, T);
3535 }
3536
3537 /// Emits a diagnostic complaining that the expression does not have
3538 /// integral or enumeration type.
3539 virtual SemaDiagnosticBuilder
3541 };
3542
3543 /// Perform a contextual implicit conversion.
3545 SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter);
3546
3547
3554
3555 // Note that LK_String is intentionally after the other literals, as
3556 // this is used for diagnostics logic.
3567
3569 NestedNameSpecifier *Qualifier,
3570 NamedDecl *FoundDecl,
3571 NamedDecl *Member);
3572
3573 // Members have to be NamespaceDecl* or TranslationUnitDecl*.
3574 // TODO: make this is a typesafe union.
3577
3579
3580 void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl,
3581 ArrayRef<Expr *> Args,
3582 OverloadCandidateSet &CandidateSet,
3583 bool SuppressUserConversions = false,
3584 bool PartialOverloading = false,
3585 bool AllowExplicit = true,
3586 bool AllowExplicitConversion = false,
3587 ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
3588 ConversionSequenceList EarlyConversions = None,
3590 void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
3591 ArrayRef<Expr *> Args,
3592 OverloadCandidateSet &CandidateSet,
3593 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
3594 bool SuppressUserConversions = false,
3595 bool PartialOverloading = false,
3596 bool FirstArgumentIsBase = false);
3597 void AddMethodCandidate(DeclAccessPair FoundDecl,
3598 QualType ObjectType,
3599 Expr::Classification ObjectClassification,
3600 ArrayRef<Expr *> Args,
3601 OverloadCandidateSet& CandidateSet,
3602 bool SuppressUserConversion = false,
3604 void AddMethodCandidate(CXXMethodDecl *Method,
3605 DeclAccessPair FoundDecl,
3606 CXXRecordDecl *ActingContext, QualType ObjectType,
3607 Expr::Classification ObjectClassification,
3608 ArrayRef<Expr *> Args,
3609 OverloadCandidateSet& CandidateSet,
3610 bool SuppressUserConversions = false,
3611 bool PartialOverloading = false,
3612 ConversionSequenceList EarlyConversions = None,
3614 void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl,
3615 DeclAccessPair FoundDecl,
3616 CXXRecordDecl *ActingContext,
3617 TemplateArgumentListInfo *ExplicitTemplateArgs,
3618 QualType ObjectType,
3619 Expr::Classification ObjectClassification,
3620 ArrayRef<Expr *> Args,
3621 OverloadCandidateSet& CandidateSet,
3622 bool SuppressUserConversions = false,
3623 bool PartialOverloading = false,
3626 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
3627 TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
3628 OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
3629 bool PartialOverloading = false, bool AllowExplicit = true,
3630 ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
3633 FunctionTemplateDecl *FunctionTemplate, ArrayRef<QualType> ParamTypes,
3634 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet,
3635 ConversionSequenceList &Conversions, bool SuppressUserConversions,
3636 CXXRecordDecl *ActingContext = nullptr, QualType ObjectType = QualType(),
3637 Expr::Classification ObjectClassification = {},
3640 CXXConversionDecl *Conversion, DeclAccessPair FoundDecl,
3641 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
3642 OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
3643 bool AllowExplicit, bool AllowResultConversion = true);
3645 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
3646 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
3647 OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
3648 bool AllowExplicit, bool AllowResultConversion = true);
3649 void AddSurrogateCandidate(CXXConversionDecl *Conversion,
3650 DeclAccessPair FoundDecl,
3651 CXXRecordDecl *ActingContext,
3652 const FunctionProtoType *Proto,
3653 Expr *Object, ArrayRef<Expr *> Args,
3654 OverloadCandidateSet& CandidateSet);
3656 const UnresolvedSetImpl &Functions, ArrayRef<Expr *> Args,
3657 OverloadCandidateSet &CandidateSet,
3658 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
3659 void AddMemberOperatorCandidates(OverloadedOperatorKind Op,
3660 SourceLocation OpLoc, ArrayRef<Expr *> Args,
3661 OverloadCandidateSet &CandidateSet,
3663 void AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
3664 OverloadCandidateSet& CandidateSet,
3665 bool IsAssignmentOperator = false,
3666 unsigned NumContextualBoolArguments = 0);
3667 void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
3668 SourceLocation OpLoc, ArrayRef<Expr *> Args,
3669 OverloadCandidateSet& CandidateSet);
3670 void AddArgumentDependentLookupCandidates(DeclarationName Name,
3671 SourceLocation Loc,
3672 ArrayRef<Expr *> Args,
3673 TemplateArgumentListInfo *ExplicitTemplateArgs,
3674 OverloadCandidateSet& CandidateSet,
3675 bool PartialOverloading = false);
3676
3677 // Emit as a 'note' the specific overload candidate
3679 NamedDecl *Found, FunctionDecl *Fn,
3681 QualType DestType = QualType(), bool TakingAddress = false);
3682
3683 // Emit as a series of 'note's all template and non-templates identified by
3684 // the expression Expr
3685 void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
3686 bool TakingAddress = false);
3687
3688 /// Check the enable_if expressions on the given function. Returns the first
3689 /// failing attribute, or NULL if they were all successful.
3690 EnableIfAttr *CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc,
3691 ArrayRef<Expr *> Args,
3692 bool MissingImplicitThis = false);
3693
3694 /// Find the failed Boolean condition within a given Boolean
3695 /// constant expression, and describe it with a string.
3696 std::pair<Expr *, std::string> findFailedBooleanCondition(Expr *Cond);
3697
3698 /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
3699 /// non-ArgDependent DiagnoseIfAttrs.
3700 ///
3701 /// Argument-dependent diagnose_if attributes should be checked each time a
3702 /// function is used as a direct callee of a function call.
3703 ///
3704 /// Returns true if any errors were emitted.
3705 bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
3706 const Expr *ThisArg,
3707 ArrayRef<const Expr *> Args,
3708 SourceLocation Loc);
3709
3710 /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
3711 /// ArgDependent DiagnoseIfAttrs.
3712 ///
3713 /// Argument-independent diagnose_if attributes should be checked on every use
3714 /// of a function.
3715 ///
3716 /// Returns true if any errors were emitted.
3717 bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND,
3718 SourceLocation Loc);
3719
3720 /// Returns whether the given function's address can be taken or not,
3721 /// optionally emitting a diagnostic if the address can't be taken.
3722 ///
3723 /// Returns false if taking the address of the function is illegal.
3724 bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
3725 bool Complain = false,
3726 SourceLocation Loc = SourceLocation());
3727
3728 // [PossiblyAFunctionType] --> [Return]
3729 // NonFunctionType --> NonFunctionType
3730 // R (A) --> R(A)
3731 // R (*)(A) --> R (A)
3732 // R (&)(A) --> R (A)
3733 // R (S::*)(A) --> R (A)
3734 QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
3735
3736 FunctionDecl *
3737 ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr,
3738 QualType TargetType,
3739 bool Complain,
3740 DeclAccessPair &Found,
3741 bool *pHadMultipleCandidates = nullptr);
3742
3743 FunctionDecl *
3744 resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult);
3745
3747 ExprResult &SrcExpr, bool DoFunctionPointerConversion = false);
3748
3749 FunctionDecl *
3751 bool Complain = false,
3752 DeclAccessPair *Found = nullptr);
3753
3755 ExprResult &SrcExpr,
3756 bool DoFunctionPointerConverion = false,
3757 bool Complain = false,
3758 SourceRange OpRangeForComplaining = SourceRange(),
3759 QualType DestTypeForComplaining = QualType(),
3760 unsigned DiagIDForComplaining = 0);
3761
3762
3763 Expr *FixOverloadedFunctionReference(Expr *E,
3764 DeclAccessPair FoundDecl,
3765 FunctionDecl *Fn);
3767 DeclAccessPair FoundDecl,
3768 FunctionDecl *Fn);
3769
3770 void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
3771 ArrayRef<Expr *> Args,
3772 OverloadCandidateSet &CandidateSet,
3773 bool PartialOverloading = false);
3775 LookupResult &R, TemplateArgumentListInfo *ExplicitTemplateArgs,
3776 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet);
3777
3778 // An enum used to represent the different possible results of building a
3779 // range-based for loop.
3785
3787 SourceLocation RangeLoc,
3788 const DeclarationNameInfo &NameInfo,
3789 LookupResult &MemberLookup,
3790 OverloadCandidateSet *CandidateSet,
3791 Expr *Range, ExprResult *CallExpr);
3792
3795 SourceLocation LParenLoc,
3796 MultiExprArg Args,
3797 SourceLocation RParenLoc,
3798 Expr *ExecConfig,
3799 bool AllowTypoCorrection=true,
3800 bool CalleesAddressIsTaken=false);
3801
3803 MultiExprArg Args, SourceLocation RParenLoc,
3804 OverloadCandidateSet *CandidateSet,
3806
3810 const UnresolvedSetImpl &Fns,
3811 bool PerformADL = true);
3812
3815 const UnresolvedSetImpl &Fns,
3816 Expr *input, bool RequiresADL = true);
3817
3820 const UnresolvedSetImpl &Fns,
3821 ArrayRef<Expr *> Args, bool RequiresADL = true);
3824 const UnresolvedSetImpl &Fns,
3825 Expr *LHS, Expr *RHS,
3826 bool RequiresADL = true,
3827 bool AllowRewrittenCandidates = true,
3828 FunctionDecl *DefaultedFn = nullptr);
3830 const UnresolvedSetImpl &Fns,
3831 Expr *LHS, Expr *RHS,
3832 FunctionDecl *DefaultedFn);
3833
3835 SourceLocation RLoc,
3836 Expr *Base,Expr *Idx);
3837
3839 SourceLocation LParenLoc,
3840 MultiExprArg Args,
3841 SourceLocation RParenLoc,
3842 bool AllowRecovery = false);
3845 MultiExprArg Args,
3846 SourceLocation RParenLoc);
3847
3849 SourceLocation OpLoc,
3850 bool *NoArrowOperatorFound = nullptr);
3851
3852 /// CheckCallReturnType - Checks that a call expression's return type is
3853 /// complete. Returns true on failure. The location passed in is the location
3854 /// that best represents the call.
3855 bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
3856 CallExpr *CE, FunctionDecl *FD);
3857
3858 /// Helpers for dealing with blocks and functions.
3860 bool CheckParameterNames);
3864
3865 /// \name Name lookup
3866 ///
3867 /// These routines provide name lookup that is used during semantic
3868 /// analysis to resolve the various kinds of names (identifiers,
3869 /// overloaded operator names, constructor names, etc.) into zero or
3870 /// more declarations within a particular scope. The major entry
3871 /// points are LookupName, which performs unqualified name lookup,
3872 /// and LookupQualifiedName, which performs qualified name lookup.
3873 ///
3874 /// All name lookup is performed based on some specific criteria,
3875 /// which specify what names will be visible to name lookup and how
3876 /// far name lookup should work. These criteria are important both
3877 /// for capturing language semantics (certain lookups will ignore
3878 /// certain names, for example) and for performance, since name
3879 /// lookup is often a bottleneck in the compilation of C++. Name
3880 /// lookup criteria is specified via the LookupCriteria enumeration.
3881 ///
3882 /// The results of name lookup can vary based on the kind of name
3883 /// lookup performed, the current language, and the translation
3884 /// unit. In C, for example, name lookup will either return nothing
3885 /// (no entity found) or a single declaration. In C++, name lookup
3886 /// can additionally refer to a set of overloaded functions or
3887 /// result in an ambiguity. All of the possible results of name
3888 /// lookup are captured by the LookupResult class, which provides
3889 /// the ability to distinguish among them.
3890 //@{
3891
3892 /// Describes the kind of name lookup to perform.
3894 /// Ordinary name lookup, which finds ordinary names (functions,
3895 /// variables, typedefs, etc.) in C and most kinds of names
3896 /// (functions, variables, members, types, etc.) in C++.
3898 /// Tag name lookup, which finds the names of enums, classes,
3899 /// structs, and unions.
3901 /// Label name lookup.
3903 /// Member name lookup, which finds the names of
3904 /// class/struct/union members.
3906 /// Look up of an operator name (e.g., operator+) for use with
3907 /// operator overloading. This lookup is similar to ordinary name
3908 /// lookup, but will ignore any declarations that are class members.
3910 /// Look up a name following ~ in a destructor name. This is an ordinary
3911 /// lookup, but prefers tags to typedefs.
3913 /// Look up of a name that precedes the '::' scope resolution
3914 /// operator in C++. This lookup completely ignores operator, object,
3915 /// function, and enumerator names (C++ [basic.lookup.qual]p1).
3917 /// Look up a namespace name within a C++ using directive or
3918 /// namespace alias definition, ignoring non-namespace names (C++
3919 /// [basic.lookup.udir]p1).
3921 /// Look up all declarations in a scope with the given name,
3922 /// including resolved using declarations. This is appropriate
3923 /// for checking redeclarations for a using declaration.
3925 /// Look up an ordinary name that is going to be redeclared as a
3926 /// name with linkage. This lookup ignores any declarations that
3927 /// are outside of the current scope unless they have linkage. See
3928 /// C99 6.2.2p4-5 and C++ [basic.link]p6.
3930 /// Look up a friend of a local class. This lookup does not look
3931 /// outside the innermost non-class scope. See C++11 [class.friend]p11.
3933 /// Look up the name of an Objective-C protocol.
3935 /// Look up implicit 'self' parameter of an objective-c method.
3937 /// Look up the name of an OpenMP user-defined reduction operation.
3939 /// Look up the name of an OpenMP user-defined mapper.
3941 /// Look up any declaration with any name.
3944
3945 /// Specifies whether (or how) name lookup is being performed for a
3946 /// redeclaration (vs. a reference).
3948 /// The lookup is a reference to this name that is not for the
3949 /// purpose of redeclaring the name.
3951 /// The lookup results will be used for redeclaration of a name,
3952 /// if an entity by that name already exists and is visible.
3954 /// The lookup results will be used for redeclaration of a name
3955 /// with external linkage; non-visible lookup results with external linkage
3956 /// may also be found.
3959
3961 // A declaration with an owning module for linkage can never link against
3962 // anything that is not visible. We don't need to check linkage here; if
3963 // the context has internal linkage, redeclaration lookup won't find things
3964 // from other TUs, and we can't safely compute linkage yet in general.
3965 if (cast<Decl>(CurContext)
3966 ->getOwningModuleForLinkage(/*IgnoreLinkage*/true))
3969 }
3970
3971 /// The possible outcomes of name lookup for a literal operator.
3973 /// The lookup resulted in an error.
3975 /// The lookup found no match but no diagnostic was issued.
3977 /// The lookup found a single 'cooked' literal operator, which
3978 /// expects a normal literal to be built and passed to it.
3980 /// The lookup found a single 'raw' literal operator, which expects
3981 /// a string literal containing the spelling of the literal token.
3983 /// The lookup found an overload set of literal operator templates,
3984 /// which expect the characters of the spelling of the literal token to be
3985 /// passed as a non-type template argument pack.
3987 /// The lookup found an overload set of literal operator templates,
3988 /// which expect the character type and characters of the spelling of the
3989 /// string literal token to be passed as template arguments.
3991 };
3992
3993 SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D,
3994 CXXSpecialMember SM,
3995 bool ConstArg,
3996 bool VolatileArg,
3997 bool RValueThis,
3998 bool ConstThis,
3999 bool VolatileThis);
4000
4001 typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
4002 typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
4004
4005private:
4006 bool CppLookupName(LookupResult &R, Scope *S);
4007
4008 struct TypoExprState {
4009 std::unique_ptr<TypoCorrectionConsumer> Consumer;
4010 TypoDiagnosticGenerator DiagHandler;
4011 TypoRecoveryCallback RecoveryHandler;
4012 TypoExprState();
4013 TypoExprState(TypoExprState &&other) noexcept;
4014 TypoExprState &operator=(TypoExprState &&other) noexcept;
4015 };
4016
4017 /// The set of unhandled TypoExprs and their associated state.
4018 llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
4019
4020 /// Creates a new TypoExpr AST node.
4021 TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
4024
4025 // The set of known/encountered (unique, canonicalized) NamespaceDecls.
4026 //
4027 // The boolean value will be true to indicate that the namespace was loaded
4028 // from an AST/PCH file, or false otherwise.
4029 llvm::MapVector<NamespaceDecl*, bool> KnownNamespaces;
4030
4031 /// Whether we have already loaded known namespaces from an extenal
4032 /// source.
4033 bool LoadedExternalKnownNamespaces;
4034
4035 /// Helper for CorrectTypo and CorrectTypoDelayed used to create and
4036 /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
4037 /// should be skipped entirely.
4038 std::unique_ptr<TypoCorrectionConsumer>
4039 makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo,
4040 Sema::LookupNameKind LookupKind, Scope *S,
4041 CXXScopeSpec *SS,
4043 DeclContext *MemberContext, bool EnteringContext,
4044 const ObjCObjectPointerType *OPT,
4045 bool ErrorRecovery);
4046
4047public:
4048 const TypoExprState &getTypoExprState(TypoExpr *TE) const;
4049
4050 /// Clears the state of the given TypoExpr.
4051 void clearDelayedTypo(TypoExpr *TE);
4052
4053 /// Look up a name, looking for a single declaration. Return
4054 /// null if the results were absent, ambiguous, or overloaded.
4055 ///
4056 /// It is preferable to use the elaborated form and explicitly handle
4057 /// ambiguity and overloaded.
4059 SourceLocation Loc,
4060 LookupNameKind NameKind,
4061 RedeclarationKind Redecl
4063 bool LookupBuiltin(LookupResult &R);
4064 void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID);
4065 bool LookupName(LookupResult &R, Scope *S,
4066 bool AllowBuiltinCreation = false);
4067 bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
4068 bool InUnqualifiedLookup = false);
4069 bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
4070 CXXScopeSpec &SS);
4072 bool AllowBuiltinCreation = false,
4073 bool EnteringContext = false);
4075 RedeclarationKind Redecl
4077 bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class);
4078
4080 UnresolvedSetImpl &Functions);
4081
4083 SourceLocation GnuLabelLoc = SourceLocation());
4084
4088 unsigned Quals);
4089 CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals,
4090 bool RValueThis, unsigned ThisQuals);
4092 unsigned Quals);
4093 CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals,
4094 bool RValueThis, unsigned ThisQuals);
4096
4097 bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id);
4100 bool AllowRaw, bool AllowTemplate,
4101 bool AllowStringTemplate, bool DiagnoseMissing,
4102 StringLiteral *StringLit = nullptr);
4103 bool isKnownName(StringRef name);
4104
4105 /// Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
4107 Emitted,
4108 CUDADiscarded, // Discarded due to CUDA/HIP hostness
4109 OMPDiscarded, // Discarded due to OpenMP hostness
4110 TemplateDiscarded, // Discarded due to uninstantiated templates
4111 Unknown,
4112 };
4113 FunctionEmissionStatus getEmissionStatus(FunctionDecl *Decl,
4114 bool Final = false);
4115
4116 // Whether the callee should be ignored in CUDA/HIP/OpenMP host/device check.
4118
4120 ArrayRef<Expr *> Args, ADLResult &Functions);
4121
4122 void LookupVisibleDecls(Scope *S, LookupNameKind Kind,
4124 bool IncludeGlobalScope = true,
4125 bool LoadExternal = true);
4126 void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
4128 bool IncludeGlobalScope = true,
4129 bool IncludeDependentBases = false,
4130 bool LoadExternal = true);
4131
4133 CTK_NonError, // CorrectTypo used in a non error recovery situation.
4134 CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
4136
4138 Sema::LookupNameKind LookupKind,
4139 Scope *S, CXXScopeSpec *SS,
4141 CorrectTypoKind Mode,
4142 DeclContext *MemberContext = nullptr,
4143 bool EnteringContext = false,
4144 const ObjCObjectPointerType *OPT = nullptr,
4145 bool RecordFailure = true);
4146
4148 Sema::LookupNameKind LookupKind, Scope *S,
4149 CXXScopeSpec *SS,
4153 DeclContext *MemberContext = nullptr,
4154 bool EnteringContext = false,
4155 const ObjCObjectPointerType *OPT = nullptr);
4156
4157 /// Process any TypoExprs in the given Expr and its children,
4158 /// generating diagnostics as appropriate and returning a new Expr if there
4159 /// were typos that were all successfully corrected and ExprError if one or
4160 /// more typos could not be corrected.
4161 ///
4162 /// \param E The Expr to check for TypoExprs.
4163 ///
4164 /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
4165 /// initializer.
4166 ///
4167 /// \param RecoverUncorrectedTypos If true, when typo correction fails, it
4168 /// will rebuild the given Expr with all TypoExprs degraded to RecoveryExprs.
4169 ///
4170 /// \param Filter A function applied to a newly rebuilt Expr to determine if
4171 /// it is an acceptable/usable result from a single combination of typo
4172 /// corrections. As long as the filter returns ExprError, different
4173 /// combinations of corrections will be tried until all are exhausted.
4175 Expr *E, VarDecl *InitDecl = nullptr,
4176 bool RecoverUncorrectedTypos = false,
4177 llvm::function_ref<ExprResult(Expr *)> Filter =
4178 [](Expr *E) -> ExprResult { return E; });
4179
4181 ExprResult ER, VarDecl *InitDecl = nullptr,
4182 bool RecoverUncorrectedTypos = false,
4183 llvm::function_ref<ExprResult(Expr *)> Filter =
4184 [](Expr *E) -> ExprResult { return E; }) {
4185 return ER.isInvalid()
4186 ? ER
4187 : CorrectDelayedTyposInExpr(ER.get(), InitDecl,
4188 RecoverUncorrectedTypos, Filter);
4189 }
4190
4191 void diagnoseTypo(const TypoCorrection &Correction,
4192 const PartialDiagnostic &TypoDiag,
4193 bool ErrorRecovery = true);
4194
4195 void diagnoseTypo(const TypoCorrection &Correction,
4196 const PartialDiagnostic &TypoDiag,
4197 const PartialDiagnostic &PrevNote,
4198 bool ErrorRecovery = true);
4199
4200 void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F);
4201
4202 void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc,
4203 ArrayRef<Expr *> Args,
4204 AssociatedNamespaceSet &AssociatedNamespaces,
4205 AssociatedClassSet &AssociatedClasses);
4206
4207 void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S,
4208 bool ConsiderLinkage, bool AllowInlineNamespace);
4209
4210 bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old);
4211
4212 void DiagnoseAmbiguousLookup(LookupResult &Result);
4213 //@}
4214
4215 /// Attempts to produce a RecoveryExpr after some AST node cannot be created.
4216 ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End,
4217 ArrayRef<Expr *> SubExprs,
4218 QualType T = QualType());
4219
4220 ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *&Id,
4221 SourceLocation IdLoc,
4222 bool TypoCorrection = false);
4223 FunctionDecl *CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID,
4224 SourceLocation Loc);
4225 NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
4226 Scope *S, bool ForRedeclaration,
4227 SourceLocation Loc);
4228 NamedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
4229 Scope *S);
4231 FunctionDecl *FD);
4232 void AddKnownFunctionAttributes(FunctionDecl *FD);
4233
4234 // More parsing and symbol table subroutines.
4235
4237 // Decl attributes - this routine is the top level dispatcher.
4239 // Helper for delayed processing of attributes.
4241 const ParsedAttributesView &AttrList);
4243 bool IncludeCXX11Attributes = true);
4245 const ParsedAttributesView &AttrList);
4246
4248
4249 /// Determine if type T is a valid subject for a nonnull and similar
4250 /// attributes. By default, we look through references (the behavior used by
4251 /// nonnull), but if the second parameter is true, then we treat a reference
4252 /// type as valid.
4253 bool isValidPointerAttrType(QualType T, bool RefOkay = false);
4254
4255 bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value);
4257 const FunctionDecl *FD = nullptr);
4258 bool CheckAttrTarget(const ParsedAttr &CurrAttr);
4259 bool CheckAttrNoArgs(const ParsedAttr &CurrAttr);
4260 bool checkStringLiteralArgumentAttr(const ParsedAttr &Attr, unsigned ArgNum,
4261 StringRef &Str,
4262 SourceLocation *ArgLocation = nullptr);
4263 bool checkSectionName(SourceLocation LiteralLoc, StringRef Str);
4264 bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str);
4266 CXXRecordDecl *RD, SourceRange Range, bool BestCase,
4267 MSInheritanceModel SemanticSpelling);
4268
4270
4271 /// Adjust the calling convention of a method to be the ABI default if it
4272 /// wasn't specified explicitly. This handles method types formed from
4273 /// function type typedefs and typename template arguments.
4274 void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor,
4275 SourceLocation Loc);
4276
4277 // Check if there is an explicit attribute, but only look through parens.
4278 // The intent is to look for an attribute on the current declarator, but not
4279 // one that came from a typedef.
4281
4282 /// Get the outermost AttributedType node that sets a calling convention.
4283 /// Valid types should not have multiple attributes with different CCs.
4285
4286 /// Stmt attributes - this routine is the top level dispatcher.
4288 const ParsedAttributesView &Attrs,
4289 SourceRange Range);
4290
4292 ObjCMethodDecl *MethodDecl,
4293 bool IsProtocolMethodDecl);
4294
4296 ObjCMethodDecl *Overridden,
4297 bool IsProtocolMethodDecl);
4298
4299 /// WarnExactTypedMethods - This routine issues a warning if method
4300 /// implementation declaration matches exactly that of its declaration.
4302 ObjCMethodDecl *MethodDecl,
4303 bool IsProtocolMethodDecl);
4304
4306
4307 /// CheckImplementationIvars - This routine checks if the instance variables
4308 /// listed in the implelementation match those listed in the interface.
4310 ObjCIvarDecl **Fields, unsigned nIvars,
4311 SourceLocation Loc);
4312
4313 /// ImplMethodsVsClassMethods - This is main routine to warn if any method
4314 /// remains unimplemented in the class or category \@implementation.
4316 ObjCContainerDecl* IDecl,
4317 bool IncompleteImpl = false);
4318
4319 /// DiagnoseUnimplementedProperties - This routine warns on those properties
4320 /// which must be implemented by this implementation.
4322 ObjCContainerDecl *CDecl,
4323 bool SynthesizeProperties);
4324
4325 /// Diagnose any null-resettable synthesized setters.
4327
4328 /// DefaultSynthesizeProperties - This routine default synthesizes all
4329 /// properties which must be synthesized in the class's \@implementation.
4331 ObjCInterfaceDecl *IDecl,
4332 SourceLocation AtEnd);
4334
4335 /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
4336 /// an ivar synthesized for 'Method' and 'Method' is a property accessor
4337 /// declared in class 'IFace'.
4339 ObjCMethodDecl *Method, ObjCIvarDecl *IV);
4340
4341 /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which
4342 /// backs the property is not used in the property's accessor.
4344 const ObjCImplementationDecl *ImplD);
4345
4346 /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
4347 /// it property has a backing ivar, returns this ivar; otherwise, returns NULL.
4348 /// It also returns ivar's property on success.
4350 const ObjCPropertyDecl *&PDecl) const;
4351
4352 /// Called by ActOnProperty to handle \@property declarations in
4353 /// class extensions.
4355 SourceLocation AtLoc,
4356 SourceLocation LParenLoc,
4357 FieldDeclarator &FD,
4358 Selector GetterSel,
4359 SourceLocation GetterNameLoc,
4360 Selector SetterSel,
4361 SourceLocation SetterNameLoc,
4362 const bool isReadWrite,
4363 unsigned &Attributes,
4364 const unsigned AttributesAsWritten,
4365 QualType T,
4366 TypeSourceInfo *TSI,
4367 tok::ObjCKeywordKind MethodImplKind);
4368
4369 /// Called by ActOnProperty and HandlePropertyInClassExtension to
4370 /// handle creating the ObjcPropertyDecl for a category or \@interface.
4372 ObjCContainerDecl *CDecl,
4373 SourceLocation AtLoc,
4374 SourceLocation LParenLoc,
4375 FieldDeclarator &FD,
4376 Selector GetterSel,
4377 SourceLocation GetterNameLoc,
4378 Selector SetterSel,
4379 SourceLocation SetterNameLoc,
4380 const bool isReadWrite,
4381 const unsigned Attributes,
4382 const unsigned AttributesAsWritten,
4383 QualType T,
4384 TypeSourceInfo *TSI,
4385 tok::ObjCKeywordKind MethodImplKind,
4386 DeclContext *lexicalDC = nullptr);
4387
4388 /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
4389 /// warning) when atomic property has one but not the other user-declared
4390 /// setter or getter.
4392 ObjCInterfaceDecl* IDecl);
4393
4395
4397 const ObjCImplementationDecl *ImplD,
4398 const ObjCInterfaceDecl *IFD);
4399
4401
4406
4407 /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
4408 /// true, or false, accordingly.
4409 bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
4410 const ObjCMethodDecl *PrevMethod,
4411 MethodMatchStrategy strategy = MMS_strict);
4412
4413 /// MatchAllMethodDeclarations - Check methods declaraed in interface or
4414 /// or protocol against those declared in their implementations.
4415 void MatchAllMethodDeclarations(const SelectorSet &InsMap,
4416 const SelectorSet &ClsMap,
4417 SelectorSet &InsMapSeen,
4418 SelectorSet &ClsMapSeen,
4419 ObjCImplDecl* IMPDecl,
4420 ObjCContainerDecl* IDecl,
4421 bool &IncompleteImpl,
4422 bool ImmediateClass,
4423 bool WarnCategoryMethodImpl=false);
4424
4425 /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
4426 /// category matches with those implemented in its primary class and
4427 /// warns each time an exact match is found.
4429
4430 /// Add the given method to the list of globally-known methods.
4432
4433 /// Returns default addr space for method qualifiers.
4435
4436private:
4437 /// AddMethodToGlobalPool - Add an instance or factory method to the global
4438 /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
4439 void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
4440
4441 /// LookupMethodInGlobalPool - Returns the instance or factory method and
4442 /// optionally warns if there are multiple signatures.
4443 ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
4444 bool receiverIdOrClass,
4445 bool instance);
4446
4447public:
4448 /// - Returns instance or factory methods in global method pool for
4449 /// given selector. It checks the desired kind first, if none is found, and
4450 /// parameter checkTheOther is set, it then checks the other kind. If no such
4451 /// method or only one method is found, function returns false; otherwise, it
4452 /// returns true.
4453 bool
4456 bool InstanceFirst, bool CheckTheOther,
4457 const ObjCObjectType *TypeBound = nullptr);
4458
4459 bool
4461 SourceRange R, bool receiverIdOrClass,
4463
4464 void
4466 Selector Sel, SourceRange R,
4467 bool receiverIdOrClass);
4468
4469private:
4470 /// - Returns a selector which best matches given argument list or
4471 /// nullptr if none could be found
4472 ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
4473 bool IsInstance,
4475
4476
4477 /// Record the typo correction failure and return an empty correction.
4478 TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
4479 bool RecordFailure = true) {
4480 if (RecordFailure)
4481 TypoCorrectionFailures[Typo].insert(TypoLoc);
4482 return TypoCorrection();
4483 }
4484
4485public:
4486 /// AddInstanceMethodToGlobalPool - All instance methods in a translation
4487 /// unit are added to a global pool. This allows us to efficiently associate
4488 /// a selector with a method declaraation for purposes of typechecking
4489 /// messages sent to "id" (where the class of the object is unknown).
4490 void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
4491 AddMethodToGlobalPool(Method, impl, /*instance*/true);
4492 }
4493
4494 /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
4495 void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
4496 AddMethodToGlobalPool(Method, impl, /*instance*/false);
4497 }
4498
4499 /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
4500 /// pool.
4502
4503 /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
4504 /// there are multiple signatures.
4506 bool receiverIdOrClass=false) {
4507 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
4508 /*instance*/true);
4509 }
4510
4511 /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
4512 /// there are multiple signatures.
4514 bool receiverIdOrClass=false) {
4515 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
4516 /*instance*/false);
4517 }
4518
4520 QualType ObjectType=QualType());
4521 /// LookupImplementedMethodInGlobalPool - Returns the method which has an
4522 /// implementation.
4524
4525 /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
4526 /// initialization.
4529
4530 //===--------------------------------------------------------------------===//
4531 // Statement Parsing Callbacks: SemaStmt.cpp.
4532public:
4534 public:
4535 FullExprArg() : E(nullptr) { }
4536 FullExprArg(Sema &actions) : E(nullptr) { }
4537
4539 return E;
4540 }
4541
4542 Expr *get() const { return E; }
4543
4545 return E;
4546 }
4547
4548 private:
4549 // FIXME: No need to make the entire Sema class a friend when it's just
4550 // Sema::MakeFullExpr that needs access to the constructor below.
4551 friend class Sema;
4552
4553 explicit FullExprArg(Expr *expr) : E(expr) {}
4554
4555 Expr *E;
4556 };
4557
4559 return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
4560 }
4562 return FullExprArg(
4563 ActOnFinishFullExpr(Arg, CC, /*DiscardedValue*/ false).get());
4564 }
4566 ExprResult FE =
4567 ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
4568 /*DiscardedValue*/ true);
4569 return FullExprArg(FE.get());
4570 }
4571
4572 StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue = true);
4574
4576 bool HasLeadingEmptyMacro = false);
4577
4578 void ActOnStartOfCompoundStmt(bool IsStmtExpr);
4582 ArrayRef<Stmt *> Elts, bool isStmtExpr);
4583
4584 /// A RAII object to enter scope of a compound statement.
4586 public:
4587 CompoundScopeRAII(Sema &S, bool IsStmtExpr = false) : S(S) {
4588 S.ActOnStartOfCompoundStmt(IsStmtExpr);
4589 }
4590
4592 S.ActOnFinishOfCompoundStmt();
4593 }
4594
4595 private:
4596 Sema &S;
4597 };
4598
4599 /// An RAII helper that pops function a function scope on exit.
4605 if (Active)
4607 }
4608 void disable() { Active = false; }
4609 };
4610
4612 SourceLocation StartLoc,
4613 SourceLocation EndLoc);
4618 SourceLocation DotDotDotLoc, ExprResult RHS,
4619 SourceLocation ColonLoc);
4620 void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
4621
4623 SourceLocation ColonLoc,
4624 Stmt *SubStmt, Scope *CurScope);
4626 SourceLocation ColonLoc, Stmt *SubStmt);
4627
4630 Stmt *SubStmt);
4631
4632 class ConditionResult;
4633 StmtResult ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr,
4634 SourceLocation LParenLoc, Stmt *InitStmt,
4635 ConditionResult Cond, SourceLocation RParenLoc,
4636 Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
4637 StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
4638 SourceLocation LParenLoc, Stmt *InitStmt,
4639 ConditionResult Cond, SourceLocation RParenLoc,
4640 Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
4642 SourceLocation LParenLoc, Stmt *InitStmt,
4643 ConditionResult Cond,
4644 SourceLocation RParenLoc);
4646 Stmt *Switch, Stmt *Body);
4648 ConditionResult Cond, SourceLocation RParenLoc,
4649 Stmt *Body);
4651 SourceLocation WhileLoc, SourceLocation CondLParen,
4652 Expr *Cond, SourceLocation CondRParen);
4653
4655 SourceLocation LParenLoc,
4656 Stmt *First,
4657 ConditionResult Second,
4658 FullExprArg Third,
4659 SourceLocation RParenLoc,
4660 Stmt *Body);
4662 Expr *collection);
4664 Stmt *First, Expr *collection,
4665 SourceLocation RParenLoc);
4666 StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
4667
4669 /// Initial building of a for-range statement.
4671 /// Instantiation or recovery rebuild of a for-range statement. Don't
4672 /// attempt any typo-correction.
4674 /// Determining whether a for-range statement could be built. Avoid any
4675 /// unnecessary or irreversible actions.
4678
4680 SourceLocation CoawaitLoc,
4681 Stmt *InitStmt,
4682 Stmt *LoopVar,
4683 SourceLocation ColonLoc, Expr *Collection,
4684 SourceLocation RParenLoc,
4685 BuildForRangeKind Kind);
4687 SourceLocation CoawaitLoc,
4688 Stmt *InitStmt,
4689 SourceLocation ColonLoc,
4690 Stmt *RangeDecl, Stmt *Begin, Stmt *End,
4691 Expr *Cond, Expr *Inc,
4692 Stmt *LoopVarDecl,
4693 SourceLocation RParenLoc,
4694 BuildForRangeKind Kind);
4695 StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body);
4696
4698 SourceLocation LabelLoc,
4699 LabelDecl *TheDecl);
4701 SourceLocation StarLoc,
4702 Expr *DestExp);
4703 StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope);
4704 StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope);
4705
4706 void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
4707 CapturedRegionKind Kind, unsigned NumParams);
4708 typedef std::pair<StringRef, QualType> CapturedParamNameType;
4709 void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
4710 CapturedRegionKind Kind,
4712 unsigned OpenMPCaptureLevel = 0);
4716 SourceLocation Loc,
4717 unsigned NumParams);
4718
4729
4732 bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD,
4734
4735 StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
4736 Scope *CurScope);
4737 StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp);
4739
4740 StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
4741 bool IsVolatile, unsigned NumOutputs,
4742 unsigned NumInputs, IdentifierInfo **Names,
4743 MultiExprArg Constraints, MultiExprArg Exprs,
4744 Expr *AsmString, MultiExprArg Clobbers,
4745 unsigned NumLabels,
4746 SourceLocation RParenLoc);
4747
4749 llvm::InlineAsmIdentifierInfo &Info);
4751 SourceLocation TemplateKWLoc,
4753 bool IsUnevaluatedContext);
4754 bool LookupInlineAsmField(StringRef Base, StringRef Member,
4755 unsigned &Offset, SourceLocation AsmLoc);
4757 SourceLocation AsmLoc);
4759 ArrayRef<Token> AsmToks,
4760 StringRef AsmString,
4761 unsigned NumOutputs, unsigned NumInputs,
4762 ArrayRef<StringRef> Constraints,
4763 ArrayRef<StringRef> Clobbers,
4764 ArrayRef<Expr*> Exprs,
4765 SourceLocation EndLoc);
4766 LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
4767 SourceLocation Location,
4768 bool AlwaysCreate);
4769
4771 SourceLocation StartLoc,
4773 bool Invalid = false);
4774
4776
4778 Decl *Parm, Stmt *Body);
4779
4781
4783 MultiStmtArg Catch, Stmt *Finally);
4784
4787 Scope *CurScope);
4789 Expr *operand);
4791 Expr *SynchExpr,
4792 Stmt *SynchBody);
4793
4795
4797 SourceLocation StartLoc,
4798 SourceLocation IdLoc,
4800
4802
4804 Decl *ExDecl, Stmt *HandlerBlock);
4806 ArrayRef<Stmt *> Handlers);
4807
4808 StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
4809 SourceLocation TryLoc, Stmt *TryBlock,
4810 Stmt *Handler);
4812 Expr *FilterExpr,
4813 Stmt *Block);
4818
4820
4822
4823 /// If it's a file scoped decl that must warn if not used, keep track
4824 /// of it.
4826
4827 /// DiagnoseUnusedExprResult - If the statement passed in is an expression
4828 /// whose result is unused, warn.
4829 void DiagnoseUnusedExprResult(const Stmt *S);
4831 void DiagnoseUnusedDecl(const NamedDecl *ND);
4832
4833 /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
4834 /// statement as a \p Body, and it is located on the same line.
4835 ///
4836 /// This helps prevent bugs due to typos, such as:
4837 /// if (condition);
4838 /// do_stuff();
4840 const Stmt *Body,
4841 unsigned DiagID);
4842
4843 /// Warn if a for/while loop statement \p S, which is followed by
4844 /// \p PossibleBody, has a suspicious null statement as a body.
4845 void DiagnoseEmptyLoopBody(const Stmt *S,
4846 const Stmt *PossibleBody);
4847
4848 /// Warn if a value is moved to itself.
4849 void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
4850 SourceLocation OpLoc);
4851
4852 /// Warn if we're implicitly casting from a _Nullable pointer type to a
4853 /// _Nonnull one.
4855 SourceLocation Loc);
4856
4857 /// Warn when implicitly casting 0 to nullptr.
4858 void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E);
4859
4864
4867 ParsingClassDepth++;
4869 }
4871 ParsingClassDepth--;
4873 }
4874
4876
4878 const ObjCInterfaceDecl *UnknownObjCClass,
4879 bool ObjCPropertyAccess,
4880 bool AvoidPartialAvailabilityChecks = false,
4881 ObjCInterfaceDecl *ClassReceiver = nullptr);
4882
4885
4886 /// Issue any -Wunguarded-availability warnings in \c FD
4888
4890
4891 //===--------------------------------------------------------------------===//
4892 // Expression Parsing Callbacks: SemaExpr.cpp.
4893
4894 bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid);
4896 const ObjCInterfaceDecl *UnknownObjCClass = nullptr,
4897 bool ObjCPropertyAccess = false,
4898 bool AvoidPartialAvailabilityChecks = false,
4899 ObjCInterfaceDecl *ClassReciever = nullptr);
4903 ObjCMethodDecl *Getter,
4904 SourceLocation Loc);
4906 ArrayRef<Expr *> Args);
4907
4909 ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl = nullptr,
4914 ExpressionEvaluationContext NewContext, ReuseLambdaContextDecl_t,
4918
4920
4923
4926
4928
4929 // Functions for marking a declaration referenced. These functions also
4930 // contain the relevant logic for marking if a reference to a function or
4931 // variable is an odr-use (in the C++11 sense). There are separate variants
4932 // for expressions referring to a decl; these exist because odr-use marking
4933 // needs to be delayed for some constant variables when we build one of the
4934 // named expressions.
4935 //
4936 // MightBeOdrUse indicates whether the use could possibly be an odr-use, and
4937 // should usually be true. This only needs to be set to false if the lack of
4938 // odr-use cannot be determined from the current context (for instance,
4939 // because the name denotes a virtual function and was written without an
4940 // explicit nested-name-specifier).
4941 void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse);
4943 bool MightBeOdrUse = true);
4945 void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base = nullptr);
4949 unsigned CapturingScopeIndex);
4950
4952 void CleanupVarDeclMarking();
4953
4957
4958 /// Try to capture the given variable.
4959 ///
4960 /// \param Var The variable to capture.
4961 ///
4962 /// \param Loc The location at which the capture occurs.
4963 ///
4964 /// \param Kind The kind of capture, which may be implicit (for either a
4965 /// block or a lambda), or explicit by-value or by-reference (for a lambda).
4966 ///
4967 /// \param EllipsisLoc The location of the ellipsis, if one is provided in
4968 /// an explicit lambda capture.
4969 ///
4970 /// \param BuildAndDiagnose Whether we are actually supposed to add the
4971 /// captures or diagnose errors. If false, this routine merely check whether
4972 /// the capture can occur without performing the capture itself or complaining
4973 /// if the variable cannot be captured.
4974 ///
4975 /// \param CaptureType Will be set to the type of the field used to capture
4976 /// this variable in the innermost block or lambda. Only valid when the
4977 /// variable can be captured.
4978 ///
4979 /// \param DeclRefType Will be set to the type of a reference to the capture
4980 /// from within the current scope. Only valid when the variable can be
4981 /// captured.
4982 ///
4983 /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
4984 /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
4985 /// This is useful when enclosing lambdas must speculatively capture
4986 /// variables that may or may not be used in certain specializations of
4987 /// a nested generic lambda.
4988 ///
4989 /// \returns true if an error occurred (i.e., the variable cannot be
4990 /// captured) and false if the capture succeeded.
4992 SourceLocation EllipsisLoc, bool BuildAndDiagnose,
4993 QualType &CaptureType,
4994 QualType &DeclRefType,
4995 const unsigned *const FunctionScopeIndexToStopAt);
4996
4997 /// Try to capture the given variable.
5000 SourceLocation EllipsisLoc = SourceLocation());
5001
5002 /// Checks if the variable must be captured.
5004
5005 /// Given a variable, determine the type that a reference to that
5006 /// variable will have in the given scope.
5008
5009 /// Mark all of the declarations referenced within a particular AST node as
5010 /// referenced. Used when template instantiation instantiates a non-dependent
5011 /// type -- entities referenced by the type are now referenced.
5014 bool SkipLocalVariables = false);
5015
5016 /// Try to recover by turning the given expression into a
5017 /// call. Returns true if recovery was attempted or an error was
5018 /// emitted; this may also leave the ExprResult invalid.
5020 bool ForceComplain = false,
5021 bool (*IsPlausibleResult)(QualType) = nullptr);
5022
5023 /// Figure out if an expression could be turned into a call.
5024 bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
5025 UnresolvedSetImpl &NonTemplateOverloads);
5026
5027 /// Try to convert an expression \p E to type \p Ty. Returns the result of the
5028 /// conversion.
5030
5031 /// Conditionally issue a diagnostic based on the current
5032 /// evaluation context.
5033 ///
5034 /// \param Statement If Statement is non-null, delay reporting the
5035 /// diagnostic until the function body is parsed, and then do a basic
5036 /// reachability analysis to determine if the statement is reachable.
5037 /// If it is unreachable, the diagnostic will not be emitted.
5038 bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
5039 const PartialDiagnostic &PD);
5040 /// Similar, but diagnostic is only produced if all the specified statements
5041 /// are reachable.
5043 const PartialDiagnostic &PD);
5044
5045 // Primary Expressions.
5046 SourceRange getExprRange(Expr *E) const;
5047
5049 Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
5050 UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand,
5051 CorrectionCandidateCallback *CCC = nullptr,
5052 bool IsInlineAsmIdentifier = false, Token *KeywordReplacement = nullptr);
5053
5056 DeclarationNameInfo &NameInfo,
5057 const TemplateArgumentListInfo *&TemplateArgs);
5058
5060
5061 bool
5064 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
5065 ArrayRef<Expr *> Args = None, TypoExpr **Out = nullptr);
5066
5068 IdentifierInfo *II);
5070
5072 IdentifierInfo *II,
5073 bool AllowBuiltinCreation=false);
5074
5076 SourceLocation TemplateKWLoc,
5077 const DeclarationNameInfo &NameInfo,
5078 bool isAddressOfOperand,
5079 const TemplateArgumentListInfo *TemplateArgs);
5080
5081 /// If \p D cannot be odr-used in the current expression evaluation context,
5082 /// return a reason explaining why. Otherwise, return NOUR_None.
5084
5086 SourceLocation Loc,
5087 const CXXScopeSpec *SS = nullptr);
5088 DeclRefExpr *
5090 const DeclarationNameInfo &NameInfo,
5091 const CXXScopeSpec *SS = nullptr,
5092 NamedDecl *FoundD = nullptr,
5093 SourceLocation TemplateKWLoc = SourceLocation(),
5094 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5095 DeclRefExpr *
5097 const DeclarationNameInfo &NameInfo,
5099 NamedDecl *FoundD = nullptr,
5100 SourceLocation TemplateKWLoc = SourceLocation(),
5101 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5102
5105 const CXXScopeSpec &SS,
5106 SourceLocation nameLoc,
5107 IndirectFieldDecl *indirectField,
5108 DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none),
5109 Expr *baseObjectExpr = nullptr,
5110 SourceLocation opLoc = SourceLocation());
5111
5113 const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R,
5114 const TemplateArgumentListInfo *TemplateArgs, const Scope *S,
5115 UnresolvedLookupExpr *AsULE = nullptr);
5117 SourceLocation TemplateKWLoc,
5118 LookupResult &R,
5119 const TemplateArgumentListInfo *TemplateArgs,
5120 bool IsDefiniteInstance,
5121 const Scope *S);
5123 const LookupResult &R,
5124 bool HasTrailingLParen);
5125
5128 const DeclarationNameInfo &NameInfo,
5129 bool IsAddressOfOperand, const Scope *S,
5130 TypeSourceInfo **RecoveryTSI = nullptr);
5131
5133 SourceLocation TemplateKWLoc,
5134 const DeclarationNameInfo &NameInfo,
5135 const TemplateArgumentListInfo *TemplateArgs);
5136
5138 LookupResult &R,
5139 bool NeedsADL,
5140 bool AcceptInvalidDecl = false);
5142 const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
5143 NamedDecl *FoundD = nullptr,
5144 const TemplateArgumentListInfo *TemplateArgs = nullptr,
5145 bool AcceptInvalidDecl = false);
5146
5148 DeclarationNameInfo &SuffixInfo,
5149 ArrayRef<Expr *> Args,
5150 SourceLocation LitEndLoc,
5151 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
5152
5157
5159
5160 ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
5162 Scope *UDLScope = nullptr);
5166 MultiExprArg Val);
5167
5168 /// ActOnStringLiteral - The specified tokens were lexed as pasted string
5169 /// fragments (e.g. "foo" "bar" L"baz").
5171 Scope *UDLScope = nullptr);
5172
5174 SourceLocation DefaultLoc,
5175 SourceLocation RParenLoc,
5176 Expr *ControllingExpr,
5177 ArrayRef<ParsedType> ArgTypes,
5178 ArrayRef<Expr *> ArgExprs);
5180 SourceLocation DefaultLoc,
5181 SourceLocation RParenLoc,
5182 Expr *ControllingExpr,
5184 ArrayRef<Expr *> Exprs);
5185
5186 // Binary/Unary Operators. 'Tok' is the token for the operator.
5188 Expr *InputExpr);
5190 UnaryOperatorKind Opc, Expr *Input);
5192 tok::TokenKind Op, Expr *Input);
5193
5196
5198 SourceLocation OpLoc,
5199 UnaryExprOrTypeTrait ExprKind,
5200 SourceRange R);
5202 UnaryExprOrTypeTrait ExprKind);
5205 UnaryExprOrTypeTrait ExprKind,
5206 bool IsType, void *TyOrEx,
5207 SourceRange ArgRange);
5208
5210 bool CheckVecStepExpr(Expr *E);
5211
5214 SourceRange ExprRange,
5215 UnaryExprOrTypeTrait ExprKind);
5217 SourceLocation OpLoc,
5218 IdentifierInfo &Name,
5219 SourceLocation NameLoc,
5220 SourceLocation RParenLoc);
5222 tok::TokenKind Kind, Expr *Input);
5223
5225 Expr *Idx, SourceLocation RLoc);
5227 Expr *Idx, SourceLocation RLoc);
5228
5230 Expr *ColumnIdx,
5231 SourceLocation RBLoc);
5232
5234 Expr *LowerBound,
5235 SourceLocation ColonLocFirst,
5236 SourceLocation ColonLocSecond,
5237 Expr *Length, Expr *Stride,
5238 SourceLocation RBLoc);
5240 SourceLocation RParenLoc,
5241 ArrayRef<Expr *> Dims,
5242 ArrayRef<SourceRange> Brackets);
5243
5244 /// Data structure for iterator expression.
5254
5256 SourceLocation LLoc, SourceLocation RLoc,
5258
5259 // This struct is for use by ActOnMemberAccess to allow
5260 // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
5261 // changing the access operator from a '.' to a '->' (to see if that is the
5262 // change needed to fix an error about an unknown member, e.g. when the class
5263 // defines a custom operator->).
5269
5271 Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
5272 CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
5273 NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
5274 const TemplateArgumentListInfo *TemplateArgs,
5275 const Scope *S,
5276 ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
5277
5280 bool IsArrow, const CXXScopeSpec &SS,
5281 SourceLocation TemplateKWLoc,
5282 NamedDecl *FirstQualifierInScope, LookupResult &R,
5283 const TemplateArgumentListInfo *TemplateArgs,
5284 const Scope *S,
5285 bool SuppressQualifierCheck = false,
5286 ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
5287
5288 ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow,
5289 SourceLocation OpLoc,
5290 const CXXScopeSpec &SS, FieldDecl *Field,
5291 DeclAccessPair FoundDecl,
5292 const DeclarationNameInfo &MemberNameInfo);
5293
5295
5296 bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
5297 const CXXScopeSpec &SS,
5298 const LookupResult &R);
5299
5301 bool IsArrow, SourceLocation OpLoc,
5302 const CXXScopeSpec &SS,
5303 SourceLocation TemplateKWLoc,
5304 NamedDecl *FirstQualifierInScope,
5305 const DeclarationNameInfo &NameInfo,
5306 const TemplateArgumentListInfo *TemplateArgs);
5307
5309 SourceLocation OpLoc,
5310 tok::TokenKind OpKind,
5311 CXXScopeSpec &SS,
5312 SourceLocation TemplateKWLoc,
5314 Decl *ObjCImpDecl);
5315
5316 MemberExpr *
5317 BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc,
5318 const CXXScopeSpec *SS, SourceLocation TemplateKWLoc,
5319 ValueDecl *Member, DeclAccessPair FoundDecl,
5320 bool HadMultipleCandidates,
5321 const DeclarationNameInfo &MemberNameInfo, QualType Ty,
5323 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5324 MemberExpr *
5325 BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc,
5326 NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc,
5327 ValueDecl *Member, DeclAccessPair FoundDecl,
5328 bool HadMultipleCandidates,
5329 const DeclarationNameInfo &MemberNameInfo, QualType Ty,
5331 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5332
5333 void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
5334 bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
5335 FunctionDecl *FDecl,
5336 const FunctionProtoType *Proto,
5337 ArrayRef<Expr *> Args,
5338 SourceLocation RParenLoc,
5339 bool ExecConfig = false);
5341 ParmVarDecl *Param,
5342 const Expr *ArgExpr);
5343
5344 /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
5345 /// This provides the location of the left/right parens and a list of comma
5346 /// locations.
5348 MultiExprArg ArgExprs, SourceLocation RParenLoc,
5349 Expr *ExecConfig = nullptr);
5351 MultiExprArg ArgExprs, SourceLocation RParenLoc,
5352 Expr *ExecConfig = nullptr,
5353 bool IsExecConfig = false,
5354 bool AllowRecovery = false);
5355 enum class AtomicArgumentOrder { API, AST };
5357 BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
5358 SourceLocation RParenLoc, MultiExprArg Args,
5362 BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc,
5363 ArrayRef<Expr *> Arg, SourceLocation RParenLoc,
5364 Expr *Config = nullptr, bool IsExecConfig = false,
5365 ADLCallKind UsesADL = ADLCallKind::NotADL);
5366
5368 MultiExprArg ExecConfig,
5369 SourceLocation GGGLoc);
5370
5372 Declarator &D, ParsedType &Ty,
5373 SourceLocation RParenLoc, Expr *CastExpr);
5375 TypeSourceInfo *Ty,
5376 SourceLocation RParenLoc,
5377 Expr *Op);
5379
5380 /// Build an altivec or OpenCL literal.
5382 SourceLocation RParenLoc, Expr *E,
5383 TypeSourceInfo *TInfo);
5384
5386
5388 ParsedType Ty,
5389 SourceLocation RParenLoc,
5390 Expr *InitExpr);
5391
5393 TypeSourceInfo *TInfo,
5394 SourceLocation RParenLoc,
5395 Expr *LiteralExpr);
5396
5398 MultiExprArg InitArgList,
5399 SourceLocation RBraceLoc);
5400
5402 MultiExprArg InitArgList,
5403 SourceLocation RBraceLoc);
5404
5406 SourceLocation EqualOrColonLoc,
5407 bool GNUSyntax,
5408 ExprResult Init);
5409
5410private:
5411 static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
5412
5413public:
5415 tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr);
5417 BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr);
5419 Expr *LHSExpr, Expr *RHSExpr);
5421 UnresolvedSetImpl &Functions);
5422
5423 void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc);
5424
5425 /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
5426 /// in the case of a the GNU conditional expr extension.
5428 SourceLocation ColonLoc,
5429 Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr);
5430
5431 /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
5433 LabelDecl *TheDecl);
5434
5435 void ActOnStartStmtExpr();
5436 ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt,
5437 SourceLocation RPLoc);
5439 SourceLocation RPLoc, unsigned TemplateDepth);
5440 // Handle the final expression in a statement expression.
5442 void ActOnStmtExprError();
5443
5444 // __builtin_offsetof(type, identifier(.identifier|[expr])*)
5447 bool isBrackets; // true if [expr], false if .ident
5448 union {
5451 } U;
5452 };
5453
5454 /// __builtin_offsetof(type, a.b[123][456].c)
5456 TypeSourceInfo *TInfo,
5457 ArrayRef<OffsetOfComponent> Components,
5458 SourceLocation RParenLoc);
5460 SourceLocation BuiltinLoc,
5462 ParsedType ParsedArgTy,
5463 ArrayRef<OffsetOfComponent> Components,
5464 SourceLocation RParenLoc);
5465
5466 // __builtin_choose_expr(constExpr, expr1, expr2)
5468 Expr *CondExpr, Expr *LHSExpr,
5469 Expr *RHSExpr, SourceLocation RPLoc);
5470
5471 // __builtin_va_arg(expr, type)
5473 SourceLocation RPLoc);
5475 TypeSourceInfo *TInfo, SourceLocation RPLoc);
5476
5477 // __builtin_LINE(), __builtin_FUNCTION(), __builtin_FILE(),
5478 // __builtin_COLUMN()
5480 SourceLocation BuiltinLoc,
5481 SourceLocation RPLoc);
5482
5483 // Build a potentially resolved SourceLocExpr.
5485 SourceLocation BuiltinLoc, SourceLocation RPLoc,
5486 DeclContext *ParentContext);
5487
5488 // __null
5490
5491 bool CheckCaseExpression(Expr *E);
5492
5493 /// Describes the result of an "if-exists" condition check.
5495 /// The symbol exists.
5497
5498 /// The symbol does not exist.
5500
5501 /// The name is a dependent name, so the results will differ
5502 /// from one instantiation to the next.
5504
5505 /// An error occurred.
5506 IER_Error
5508
5511 const DeclarationNameInfo &TargetNameInfo);
5512
5515 bool IsIfExists, CXXScopeSpec &SS,
5516 UnqualifiedId &Name);
5517
5519 bool IsIfExists,
5520 NestedNameSpecifierLoc QualifierLoc,
5521 DeclarationNameInfo NameInfo,
5522 Stmt *Nested);
5524 bool IsIfExists,
5525 CXXScopeSpec &SS, UnqualifiedId &Name,
5526 Stmt *Nested);
5527
5528 //===------------------------- "Block" Extension ------------------------===//
5529
5530 /// ActOnBlockStart - This callback is invoked when a block literal is
5531 /// started.
5532 void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope);
5533
5534 /// ActOnBlockArguments - This callback allows processing of block arguments.
5535 /// If there are no arguments, this is still invoked.
5536 void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
5537 Scope *CurScope);
5538
5539 /// ActOnBlockError - If there is an error parsing a block, this callback
5540 /// is invoked to pop the information about the block from the action impl.
5541 void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope);
5542
5543 /// ActOnBlockStmtExpr - This is called when the body of a block statement
5544 /// literal was successfully completed. ^(int x){...}
5546 Scope *CurScope);
5547
5548 //===---------------------------- Clang Extensions ----------------------===//
5549
5550 /// __builtin_convertvector(...)
5552 SourceLocation BuiltinLoc,
5553 SourceLocation RParenLoc);
5554
5555 //===---------------------------- OpenCL Features -----------------------===//
5556
5557 /// __builtin_astype(...)
5558 ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy,
5559 SourceLocation BuiltinLoc,
5560 SourceLocation RParenLoc);
5561
5562 //===---------------------------- C++ Features --------------------------===//
5563
5564 // Act on C++ namespaces
5566 SourceLocation NamespaceLoc,
5567 SourceLocation IdentLoc, IdentifierInfo *Ident,
5568 SourceLocation LBrace,
5569 const ParsedAttributesView &AttrList,
5571 void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
5572
5575
5577
5579 EnumDecl *getStdAlignValT() const;
5580
5581private:
5582 // A cache representing if we've fully checked the various comparison category
5583 // types stored in ASTContext. The bit-index corresponds to the integer value
5584 // of a ComparisonCategoryType enumerator.
5585 llvm::SmallBitVector FullyCheckedComparisonCategories;
5586
5587 ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl,
5588 CXXScopeSpec &SS,
5589 ParsedType TemplateTypeTy,
5590 IdentifierInfo *MemberOrBase);
5591
5592public:
5594 /// The '<=>' operator was used in an expression and a builtin operator
5595 /// was selected.
5597 /// A defaulted 'operator<=>' needed the comparison category. This
5598 /// typically only applies to 'std::strong_ordering', due to the implicit
5599 /// fallback return value.
5601 };
5602
5603 /// Lookup the specified comparison category types in the standard
5604 /// library, an check the VarDecls possibly returned by the operator<=>
5605 /// builtins for that type.
5606 ///
5607 /// \return The type of the comparison category type corresponding to the
5608 /// specified Kind, or a null type if an error occurs
5610 SourceLocation Loc,
5612
5613 /// Tests whether Ty is an instance of std::initializer_list and, if
5614 /// it is and Element is not NULL, assigns the element type to Element.
5615 bool isStdInitializerList(QualType Ty, QualType *Element);
5616
5617 /// Looks for the std::initializer_list template and instantiates it
5618 /// with Element, or emits an error if it's not found.
5619 ///
5620 /// \returns The instantiated template, or null on error.
5622
5623 /// Determine whether Ctor is an initializer-list constructor, as
5624 /// defined in [dcl.init.list]p2.
5625 bool isInitListConstructor(const FunctionDecl *Ctor);
5626
5627 Decl *ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc,
5628 SourceLocation NamespcLoc, CXXScopeSpec &SS,
5629 SourceLocation IdentLoc,
5630 IdentifierInfo *NamespcName,
5631 const ParsedAttributesView &AttrList);
5632
5634
5636 SourceLocation NamespaceLoc,
5637 SourceLocation AliasLoc,
5638 IdentifierInfo *Alias,
5639 CXXScopeSpec &SS,
5640 SourceLocation IdentLoc,
5641 IdentifierInfo *Ident);
5642
5643 void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow);
5644 bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target,
5645 const LookupResult &PreviousDecls,
5646 UsingShadowDecl *&PrevShadow);
5648 NamedDecl *Target,
5649 UsingShadowDecl *PrevDecl);
5650
5652 bool HasTypenameKeyword,
5653 const CXXScopeSpec &SS,
5654 SourceLocation NameLoc,
5655 const LookupResult &Previous);
5657 bool HasTypename,
5658 const CXXScopeSpec &SS,
5659 const DeclarationNameInfo &NameInfo,
5660 SourceLocation NameLoc);
5661
5663 Scope *S, AccessSpecifier AS, SourceLocation UsingLoc,
5664 bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS,
5665 DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc,
5666 const ParsedAttributesView &AttrList, bool IsInstantiation);
5667 NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom,
5668 ArrayRef<NamedDecl *> Expansions);
5669
5671
5672 /// Given a derived-class using shadow declaration for a constructor and the
5673 /// correspnding base class constructor, find or create the implicit
5674 /// synthesized derived class constructor to use for this initialization.
5677 ConstructorUsingShadowDecl *DerivedShadow);
5678
5680 SourceLocation UsingLoc,
5681 SourceLocation TypenameLoc, CXXScopeSpec &SS,
5682 UnqualifiedId &Name, SourceLocation EllipsisLoc,
5683 const ParsedAttributesView &AttrList);
5685 MultiTemplateParamsArg TemplateParams,
5686 SourceLocation UsingLoc, UnqualifiedId &Name,
5687 const ParsedAttributesView &AttrList,
5688 TypeResult Type, Decl *DeclFromDeclSpec);
5689
5690 /// BuildCXXConstructExpr - Creates a complete call to a constructor,
5691 /// including handling of its default argument expressions.
5692 ///
5693 /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
5695 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
5696 NamedDecl *FoundDecl,
5697 CXXConstructorDecl *Constructor, MultiExprArg Exprs,
5698 bool HadMultipleCandidates, bool IsListInitialization,
5699 bool IsStdInitListInitialization,
5700 bool RequiresZeroInit, unsigned ConstructKind,
5701 SourceRange ParenRange);
5702
5703 /// Build a CXXConstructExpr whose constructor has already been resolved if
5704 /// it denotes an inherited constructor.
5706 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
5707 CXXConstructorDecl *Constructor, bool Elidable,
5708 MultiExprArg Exprs,
5709 bool HadMultipleCandidates, bool IsListInitialization,
5710 bool IsStdInitListInitialization,
5711 bool RequiresZeroInit, unsigned ConstructKind,
5712 SourceRange ParenRange);
5713
5714 // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
5715 // the constructor can be elidable?
5717 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
5718 NamedDecl *FoundDecl,
5719 CXXConstructorDecl *Constructor, bool Elidable,
5720 MultiExprArg Exprs, bool HadMultipleCandidates,
5721 bool IsListInitialization,
5722 bool IsStdInitListInitialization, bool RequiresZeroInit,
5723 unsigned ConstructKind, SourceRange ParenRange);
5724
5726
5727
5728 /// Instantiate or parse a C++ default argument expression as necessary.
5729 /// Return true on error.
5731 ParmVarDecl *Param);
5732
5733 /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
5734 /// the default expr if needed.
5736 FunctionDecl *FD,
5737 ParmVarDecl *Param);
5738
5739 /// FinalizeVarWithDestructor - Prepare for calling destructor on the
5740 /// constructed variable.
5741 void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType);
5742
5743 /// Helper class that collects exception specifications for
5744 /// implicitly-declared special member functions.
5746 // Pointer to allow copying
5747 Sema *Self;
5748 // We order exception specifications thus:
5749 // noexcept is the most restrictive, but is only used in C++11.
5750 // throw() comes next.
5751 // Then a throw(collected exceptions)
5752 // Finally no specification, which is expressed as noexcept(false).
5753 // throw(...) is used instead if any called function uses it.
5754 ExceptionSpecificationType ComputedEST;
5755 llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen;
5756 SmallVector<QualType, 4> Exceptions;
5757
5758 void ClearExceptions() {
5759 ExceptionsSeen.clear();
5760 Exceptions.clear();
5761 }
5762
5763 public:
5765 : Self(&Self), ComputedEST(EST_BasicNoexcept) {
5766 if (!Self.getLangOpts().CPlusPlus11)
5767 ComputedEST = EST_DynamicNone;
5768 }
5769
5770 /// Get the computed exception specification type.
5772 assert(!isComputedNoexcept(ComputedEST) &&
5773 "noexcept(expr) should not be a possible result");
5774 return ComputedEST;
5775 }
5776
5777 /// The number of exceptions in the exception specification.
5778 unsigned size() const { return Exceptions.size(); }
5779
5780 /// The set of exceptions in the exception specification.
5781 const QualType *data() const { return Exceptions.data(); }
5782
5783 /// Integrate another called method into the collected data.
5784 void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method);
5785
5786 /// Integrate an invoked expression into the collected data.
5787 void CalledExpr(Expr *E) { CalledStmt(E); }
5788
5789 /// Integrate an invoked statement into the collected data.
5790 void CalledStmt(Stmt *S);
5791
5792 /// Overwrite an EPI's exception specification with this
5793 /// computed exception specification.
5796 ESI.Type = getExceptionSpecType();
5797 if (ESI.Type == EST_Dynamic) {
5798 ESI.Exceptions = Exceptions;
5799 } else if (ESI.Type == EST_None) {
5800 /// C++11 [except.spec]p14:
5801 /// The exception-specification is noexcept(false) if the set of
5802 /// potential exceptions of the special member function contains "any"
5803 ESI.Type = EST_NoexceptFalse;
5805 tok::kw_false).get();
5806 }
5807 return ESI;
5808 }
5809 };
5810
5811 /// Evaluate the implicit exception specification for a defaulted
5812 /// special member function.
5814
5815 /// Check the given noexcept-specifier, convert its expression, and compute
5816 /// the appropriate ExceptionSpecificationType.
5817 ExprResult ActOnNoexceptSpec(SourceLocation NoexceptLoc, Expr *NoexceptExpr,
5819
5820 /// Check the given exception-specification and update the
5821 /// exception specification information with the results.
5822 void checkExceptionSpecification(bool IsTopLevel,
5824 ArrayRef<ParsedType> DynamicExceptions,
5825 ArrayRef<SourceRange> DynamicExceptionRanges,
5826 Expr *NoexceptExpr,
5827 SmallVectorImpl<QualType> &Exceptions,
5829
5830 /// Determine if we're in a case where we need to (incorrectly) eagerly
5831 /// parse an exception specification to work around a libstdc++ bug.
5833
5834 /// Add an exception-specification to the given member function
5835 /// (or member function template). The exception-specification was parsed
5836 /// after the method itself was declared.
5839 SourceRange SpecificationRange,
5840 ArrayRef<ParsedType> DynamicExceptions,
5841 ArrayRef<SourceRange> DynamicExceptionRanges,
5842 Expr *NoexceptExpr);
5843
5844 class InheritedConstructorInfo;
5845
5846 /// Determine if a special member function should have a deleted
5847 /// definition when it is defaulted.
5848 bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
5849 InheritedConstructorInfo *ICI = nullptr,
5850 bool Diagnose = false);
5851
5852 /// Produce notes explaining why a defaulted function was defined as deleted.
5854
5855 /// Declare the implicit default constructor for the given class.
5856 ///
5857 /// \param ClassDecl The class declaration into which the implicit
5858 /// default constructor will be added.
5859 ///
5860 /// \returns The implicitly-declared default constructor.
5862 CXXRecordDecl *ClassDecl);
5863
5864 /// DefineImplicitDefaultConstructor - Checks for feasibility of
5865 /// defining this constructor as the default constructor.
5867 CXXConstructorDecl *Constructor);
5868
5869 /// Declare the implicit destructor for the given class.
5870 ///
5871 /// \param ClassDecl The class declaration into which the implicit
5872 /// destructor will be added.
5873 ///
5874 /// \returns The implicitly-declared destructor.
5876
5877 /// DefineImplicitDestructor - Checks for feasibility of
5878 /// defining this destructor as the default destructor.
5879 void DefineImplicitDestructor(SourceLocation CurrentLocation,
5880 CXXDestructorDecl *Destructor);
5881
5882 /// Build an exception spec for destructors that don't have one.
5883 ///
5884 /// C++11 says that user-defined destructors with no exception spec get one
5885 /// that looks as if the destructor was implicitly declared.
5887
5888 /// Define the specified inheriting constructor.
5890 CXXConstructorDecl *Constructor);
5891
5892 /// Declare the implicit copy constructor for the given class.
5893 ///
5894 /// \param ClassDecl The class declaration into which the implicit
5895 /// copy constructor will be added.
5896 ///
5897 /// \returns The implicitly-declared copy constructor.
5899
5900 /// DefineImplicitCopyConstructor - Checks for feasibility of
5901 /// defining this constructor as the copy constructor.
5902 void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
5903 CXXConstructorDecl *Constructor);
5904
5905 /// Declare the implicit move constructor for the given class.
5906 ///
5907 /// \param ClassDecl The Class declaration into which the implicit
5908 /// move constructor will be added.
5909 ///
5910 /// \returns The implicitly-declared move constructor, or NULL if it wasn't
5911 /// declared.
5913
5914 /// DefineImplicitMoveConstructor - Checks for feasibility of
5915 /// defining this constructor as the move constructor.
5916 void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
5917 CXXConstructorDecl *Constructor);
5918
5919 /// Declare the implicit copy assignment operator for the given class.
5920 ///
5921 /// \param ClassDecl The class declaration into which the implicit
5922 /// copy assignment operator will be added.
5923 ///
5924 /// \returns The implicitly-declared copy assignment operator.
5926
5927 /// Defines an implicitly-declared copy assignment operator.
5928 void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
5929 CXXMethodDecl *MethodDecl);
5930
5931 /// Declare the implicit move assignment operator for the given class.
5932 ///
5933 /// \param ClassDecl The Class declaration into which the implicit
5934 /// move assignment operator will be added.
5935 ///
5936 /// \returns The implicitly-declared move assignment operator, or NULL if it
5937 /// wasn't declared.
5939
5940 /// Defines an implicitly-declared move assignment operator.
5941 void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
5942 CXXMethodDecl *MethodDecl);
5943
5944 /// Force the declaration of any implicitly-declared members of this
5945 /// class.
5947
5948 /// Check a completed declaration of an implicit special member.
5950
5951 /// Determine whether the given function is an implicitly-deleted
5952 /// special member function.
5954
5955 /// Check whether 'this' shows up in the type of a static member
5956 /// function after the (naturally empty) cv-qualifier-seq would be.
5957 ///
5958 /// \returns true if an error occurred.
5960
5961 /// Whether this' shows up in the exception specification of a static
5962 /// member function.
5964
5965 /// Check whether 'this' shows up in the attributes of the given
5966 /// static member function.
5967 ///
5968 /// \returns true if an error occurred.
5970
5971 /// MaybeBindToTemporary - If the passed in expression has a record type with
5972 /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
5973 /// it simply returns the passed in expression.
5975
5976 /// Wrap the expression in a ConstantExpr if it is a potential immediate
5977 /// invocation.
5979
5981 MultiExprArg ArgsPtr,
5982 SourceLocation Loc,
5983 SmallVectorImpl<Expr*> &ConvertedArgs,
5984 bool AllowExplicit = false,
5985 bool IsListInitialization = false);
5986
5988 SourceLocation NameLoc,
5989 IdentifierInfo &Name);
5990
5992 Scope *S, CXXScopeSpec &SS,
5993 bool EnteringContext);
5995 IdentifierInfo &II, SourceLocation NameLoc,
5996 Scope *S, CXXScopeSpec &SS,
5997 ParsedType ObjectType,
5998 bool EnteringContext);
5999
6001 ParsedType ObjectType);
6002
6003 // Checks that reinterpret casts don't have undefined behavior.
6004 void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
6005 bool IsDereference, SourceRange Range);
6006
6007 /// ActOnCXXNamedCast - Parse
6008 /// {dynamic,static,reinterpret,const,addrspace}_cast's.
6010 tok::TokenKind Kind,
6011 SourceLocation LAngleBracketLoc,
6012 Declarator &D,
6013 SourceLocation RAngleBracketLoc,
6014 SourceLocation LParenLoc,
6015 Expr *E,
6016 SourceLocation RParenLoc);
6017
6019 tok::TokenKind Kind,
6020 TypeSourceInfo *Ty,
6021 Expr *E,
6022 SourceRange AngleBrackets,
6023 SourceRange Parens);
6024
6026 ExprResult Operand,
6027 SourceLocation RParenLoc);
6028
6030 Expr *Operand, SourceLocation RParenLoc);
6031
6032 ExprResult BuildCXXTypeId(QualType TypeInfoType,
6033 SourceLocation TypeidLoc,
6034 TypeSourceInfo *Operand,
6035 SourceLocation RParenLoc);
6036 ExprResult BuildCXXTypeId(QualType TypeInfoType,
6037 SourceLocation TypeidLoc,
6038 Expr *Operand,
6039 SourceLocation RParenLoc);
6040
6041 /// ActOnCXXTypeid - Parse typeid( something ).
6043 SourceLocation LParenLoc, bool isType,
6044 void *TyOrExpr,
6045 SourceLocation RParenLoc);
6046
6047 ExprResult BuildCXXUuidof(QualType TypeInfoType,
6048 SourceLocation TypeidLoc,
6049 TypeSourceInfo *Operand,
6050 SourceLocation RParenLoc);
6051 ExprResult BuildCXXUuidof(QualType TypeInfoType,
6052 SourceLocation TypeidLoc,
6053 Expr *Operand,
6054 SourceLocation RParenLoc);
6055
6056 /// ActOnCXXUuidof - Parse __uuidof( something ).
6058 SourceLocation LParenLoc, bool isType,
6059 void *TyOrExpr,
6060 SourceLocation RParenLoc);
6061
6062 /// Handle a C++1z fold-expression: ( expr op ... op expr ).
6064 tok::TokenKind Operator,
6065 SourceLocation EllipsisLoc, Expr *RHS,
6066 SourceLocation RParenLoc);
6068 SourceLocation LParenLoc, Expr *LHS,
6069 BinaryOperatorKind Operator,
6070 SourceLocation EllipsisLoc, Expr *RHS,
6071 SourceLocation RParenLoc,
6072 Optional<unsigned> NumExpansions);
6074 BinaryOperatorKind Operator);
6075
6076 //// ActOnCXXThis - Parse 'this' pointer.
6078
6079 /// Build a CXXThisExpr and mark it referenced in the current context.
6080 Expr *BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit);
6081 void MarkThisReferenced(CXXThisExpr *This);
6082
6083 /// Try to retrieve the type of the 'this' pointer.
6084 ///
6085 /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
6087
6088 /// When non-NULL, the C++ 'this' expression is allowed despite the
6089 /// current context not being a non-static member function. In such cases,
6090 /// this provides the type used for 'this'.
6092
6093 /// RAII object used to temporarily allow the C++ 'this' expression
6094 /// to be used, with the given qualifiers on the current class type.
6096 Sema &S;
6097 QualType OldCXXThisTypeOverride;
6098 bool Enabled;
6099
6100 public:
6101 /// Introduce a new scope where 'this' may be allowed (when enabled),
6102 /// using the given declaration (which is either a class template or a
6103 /// class) along with the given qualifiers.
6104 /// along with the qualifiers placed on '*this'.
6105 CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals,
6106 bool Enabled = true);
6107
6109 };
6110
6111 /// Make sure the value of 'this' is actually available in the current
6112 /// context, if it is a potentially evaluated context.
6113 ///
6114 /// \param Loc The location at which the capture of 'this' occurs.
6115 ///
6116 /// \param Explicit Whether 'this' is explicitly captured in a lambda
6117 /// capture list.
6118 ///
6119 /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
6120 /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
6121 /// This is useful when enclosing lambdas must speculatively capture
6122 /// 'this' that may or may not be used in certain specializations of
6123 /// a nested generic lambda (depending on whether the name resolves to
6124 /// a non-static member function or a static function).
6125 /// \return returns 'true' if failed, 'false' if success.
6126 bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false,
6127 bool BuildAndDiagnose = true,
6128 const unsigned *const FunctionScopeIndexToStopAt = nullptr,
6129 bool ByCopy = false);
6130
6131 /// Determine whether the given type is the type of *this that is used
6132 /// outside of the body of a member function for a type that is currently
6133 /// being defined.
6135
6136 /// ActOnCXXBoolLiteral - Parse {true,false} literals.
6138
6139
6140 /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
6142
6145 SourceLocation AtLoc, SourceLocation RParen);
6146
6147 /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
6149
6150 //// ActOnCXXThrow - Parse throw expressions.
6153 bool IsThrownVarInScope);
6154 bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E);
6155
6156 /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
6157 /// Can be interpreted either as function-style casting ("int(x)")
6158 /// or class type construction ("ClassType(x,y,z)")
6159 /// or creation of a value-initialized type ("int()").
6161 SourceLocation LParenOrBraceLoc,
6162 MultiExprArg Exprs,
6163 SourceLocation RParenOrBraceLoc,
6164 bool ListInitialization);
6165
6167 SourceLocation LParenLoc,
6168 MultiExprArg Exprs,
6169 SourceLocation RParenLoc,
6170 bool ListInitialization);
6171
6172 /// ActOnCXXNew - Parsed a C++ 'new' expression.
6173 ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
6174 SourceLocation PlacementLParen,
6175 MultiExprArg PlacementArgs,
6176 SourceLocation PlacementRParen,
6177 SourceRange TypeIdParens, Declarator &D,
6178 Expr *Initializer);
6179 ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal,
6180 SourceLocation PlacementLParen,
6181 MultiExprArg PlacementArgs,
6182 SourceLocation PlacementRParen,
6183 SourceRange TypeIdParens,
6184 QualType AllocType,
6185 TypeSourceInfo *AllocTypeInfo,
6186 Optional<Expr *> ArraySize,
6187 SourceRange DirectInitRange,
6188 Expr *Initializer);
6189
6190 /// Determine whether \p FD is an aligned allocation or deallocation
6191 /// function that is unavailable.
6193
6194 /// Produce diagnostics if \p FD is an aligned allocation or deallocation
6195 /// function that is unavailable.
6197 SourceLocation Loc);
6198
6199 bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
6200 SourceRange R);
6201
6202 /// The scope in which to find allocation functions.
6204 /// Only look for allocation functions in the global scope.
6206 /// Only look for allocation functions in the scope of the
6207 /// allocated class.
6209 /// Look for allocation functions in both the global scope
6210 /// and in the scope of the allocated class.
6211 AFS_Both
6213
6214 /// Finds the overloads of operator new and delete that are appropriate
6215 /// for the allocation.
6217 AllocationFunctionScope NewScope,
6218 AllocationFunctionScope DeleteScope,
6219 QualType AllocType, bool IsArray,
6220 bool &PassAlignment, MultiExprArg PlaceArgs,
6221 FunctionDecl *&OperatorNew,
6222 FunctionDecl *&OperatorDelete,
6223 bool Diagnose = true);
6226 ArrayRef<QualType> Params);
6227
6229 DeclarationName Name, FunctionDecl* &Operator,
6230 bool Diagnose = true);
6232 bool CanProvideSize,
6233 bool Overaligned,
6234 DeclarationName Name);
6236 CXXRecordDecl *RD);
6237
6238 /// ActOnCXXDelete - Parsed a C++ 'delete' expression
6240 bool UseGlobal, bool ArrayForm,
6241 Expr *Operand);
6243 bool IsDelete, bool CallCanBeVirtual,
6244 bool WarnOnNonAbstractTypes,
6245 SourceLocation DtorLoc);
6246
6248 Expr *Operand, SourceLocation RParen);
6250 SourceLocation RParen);
6251
6252 /// Parsed one of the type trait support pseudo-functions.
6255 SourceLocation RParenLoc);
6258 SourceLocation RParenLoc);
6259
6260 /// ActOnArrayTypeTrait - Parsed one of the binary type trait support
6261 /// pseudo-functions.
6263 SourceLocation KWLoc,
6264 ParsedType LhsTy,
6265 Expr *DimExpr,
6266 SourceLocation RParen);
6267
6269 SourceLocation KWLoc,
6270 TypeSourceInfo *TSInfo,
6271 Expr *DimExpr,
6272 SourceLocation RParen);
6273
6274 /// ActOnExpressionTrait - Parsed one of the unary type trait support
6275 /// pseudo-functions.
6277 SourceLocation KWLoc,
6278 Expr *Queried,
6279 SourceLocation RParen);
6280
6282 SourceLocation KWLoc,
6283 Expr *Queried,
6284 SourceLocation RParen);
6285
6287 Expr *Base,
6288 SourceLocation OpLoc,
6289 tok::TokenKind OpKind,
6290 ParsedType &ObjectType,
6291 bool &MayBePseudoDestructor);
6292
6294 SourceLocation OpLoc,
6295 tok::TokenKind OpKind,
6296 const CXXScopeSpec &SS,
6297 TypeSourceInfo *ScopeType,
6298 SourceLocation CCLoc,
6299 SourceLocation TildeLoc,
6300 PseudoDestructorTypeStorage DestroyedType);
6301
6303 SourceLocation OpLoc,
6304 tok::TokenKind OpKind,
6305 CXXScopeSpec &SS,
6306 UnqualifiedId &FirstTypeName,
6307 SourceLocation CCLoc,
6308 SourceLocation TildeLoc,
6309 UnqualifiedId &SecondTypeName);
6310
6312 SourceLocation OpLoc,
6313 tok::TokenKind OpKind,
6314 SourceLocation TildeLoc,
6315 const DeclSpec& DS);
6316
6317 /// MaybeCreateExprWithCleanups - If the current full-expression
6318 /// requires any cleanups, surround it with a ExprWithCleanups node.
6319 /// Otherwise, just returns the passed-in expression.
6323
6326 bool BoundToLvalueReference);
6327
6328 ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue) {
6329 return ActOnFinishFullExpr(
6330 Expr, Expr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue);
6331 }
6333 bool DiscardedValue, bool IsConstexpr = false);
6335
6336 // Marks SS invalid if it represents an incomplete type.
6338
6341 bool EnteringContext = false);
6344
6345 /// The parser has parsed a global nested-name-specifier '::'.
6346 ///
6347 /// \param CCLoc The location of the '::'.
6348 ///
6349 /// \param SS The nested-name-specifier, which will be updated in-place
6350 /// to reflect the parsed nested-name-specifier.
6351 ///
6352 /// \returns true if an error occurred, false otherwise.
6354
6355 /// The parser has parsed a '__super' nested-name-specifier.
6356 ///
6357 /// \param SuperLoc The location of the '__super' keyword.
6358 ///
6359 /// \param ColonColonLoc The location of the '::'.
6360 ///
6361 /// \param SS The nested-name-specifier, which will be updated in-place
6362 /// to reflect the parsed nested-name-specifier.
6363 ///
6364 /// \returns true if an error occurred, false otherwise.
6366 SourceLocation ColonColonLoc, CXXScopeSpec &SS);
6367
6369 bool *CanCorrect = nullptr);
6371
6372 /// Keeps information about an identifier in a nested-name-spec.
6373 ///
6375 /// The type of the object, if we're parsing nested-name-specifier in
6376 /// a member access expression.
6378
6379 /// The identifier preceding the '::'.
6381
6382 /// The location of the identifier.
6384
6385 /// The location of the '::'.
6387
6388 /// Creates info object for the most typical case.
6392 CCLoc(ColonColonLoc) {
6393 }
6394
6396 SourceLocation ColonColonLoc, QualType ObjectType)
6398 IdentifierLoc(IdLoc), CCLoc(ColonColonLoc) {
6399 }
6400 };
6401
6403 NestedNameSpecInfo &IdInfo);
6404
6406 NestedNameSpecInfo &IdInfo,
6407 bool EnteringContext,
6408 CXXScopeSpec &SS,
6409 NamedDecl *ScopeLookupResult,
6410 bool ErrorRecoveryLookup,
6411 bool *IsCorrectedToColon = nullptr,
6412 bool OnlyNamespace = false);
6413
6414 /// The parser has parsed a nested-name-specifier 'identifier::'.
6415 ///
6416 /// \param S The scope in which this nested-name-specifier occurs.
6417 ///
6418 /// \param IdInfo Parser information about an identifier in the
6419 /// nested-name-spec.
6420 ///
6421 /// \param EnteringContext Whether we're entering the context nominated by
6422 /// this nested-name-specifier.
6423 ///
6424 /// \param SS The nested-name-specifier, which is both an input
6425 /// parameter (the nested-name-specifier before this type) and an
6426 /// output parameter (containing the full nested-name-specifier,
6427 /// including this new type).
6428 ///
6429 /// \param ErrorRecoveryLookup If true, then this method is called to improve
6430 /// error recovery. In this case do not emit error message.
6431 ///
6432 /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
6433 /// are allowed. The bool value pointed by this parameter is set to 'true'
6434 /// if the identifier is treated as if it was followed by ':', not '::'.
6435 ///
6436 /// \param OnlyNamespace If true, only considers namespaces in lookup.
6437 ///
6438 /// \returns true if an error occurred, false otherwise.
6440 NestedNameSpecInfo &IdInfo,
6441 bool EnteringContext,
6442 CXXScopeSpec &SS,
6443 bool ErrorRecoveryLookup = false,
6444 bool *IsCorrectedToColon = nullptr,
6445 bool OnlyNamespace = false);
6446
6448
6450 const DeclSpec &DS,
6451 SourceLocation ColonColonLoc);
6452
6454 NestedNameSpecInfo &IdInfo,
6455 bool EnteringContext);
6456
6457 /// The parser has parsed a nested-name-specifier
6458 /// 'template[opt] template-name < template-args >::'.
6459 ///
6460 /// \param S The scope in which this nested-name-specifier occurs.
6461 ///
6462 /// \param SS The nested-name-specifier, which is both an input
6463 /// parameter (the nested-name-specifier before this type) and an
6464 /// output parameter (containing the full nested-name-specifier,
6465 /// including this new type).
6466 ///
6467 /// \param TemplateKWLoc the location of the 'template' keyword, if any.
6468 /// \param TemplateName the template name.
6469 /// \param TemplateNameLoc The location of the template name.
6470 /// \param LAngleLoc The location of the opening angle bracket ('<').
6471 /// \param TemplateArgs The template arguments.
6472 /// \param RAngleLoc The location of the closing angle bracket ('>').
6473 /// \param CCLoc The location of the '::'.
6474 ///
6475 /// \param EnteringContext Whether we're entering the context of the
6476 /// nested-name-specifier.
6477 ///
6478 ///
6479 /// \returns true if an error occurred, false otherwise.
6481 CXXScopeSpec &SS,
6482 SourceLocation TemplateKWLoc,
6484 SourceLocation TemplateNameLoc,
6485 SourceLocation LAngleLoc,
6486 ASTTemplateArgsPtr TemplateArgs,
6487 SourceLocation RAngleLoc,
6488 SourceLocation CCLoc,
6489 bool EnteringContext);
6490
6491 /// Given a C++ nested-name-specifier, produce an annotation value
6492 /// that the parser can use later to reconstruct the given
6493 /// nested-name-specifier.
6494 ///
6495 /// \param SS A nested-name-specifier.
6496 ///
6497 /// \returns A pointer containing all of the information in the
6498 /// nested-name-specifier \p SS.
6500
6501 /// Given an annotation pointer for a nested-name-specifier, restore
6502 /// the nested-name-specifier structure.
6503 ///
6504 /// \param Annotation The annotation pointer, produced by
6505 /// \c SaveNestedNameSpecifierAnnotation().
6506 ///
6507 /// \param AnnotationRange The source range corresponding to the annotation.
6508 ///
6509 /// \param SS The nested-name-specifier that will be updated with the contents
6510 /// of the annotation pointer.
6511 void RestoreNestedNameSpecifierAnnotation(void *Annotation,
6512 SourceRange AnnotationRange,
6513 CXXScopeSpec &SS);
6514
6515 bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
6516
6517 /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
6518 /// scope or nested-name-specifier) is parsed, part of a declarator-id.
6519 /// After this method is called, according to [C++ 3.4.3p3], names should be
6520 /// looked up in the declarator-id's scope, until the declarator is parsed and
6521 /// ActOnCXXExitDeclaratorScope is called.
6522 /// The 'SS' should be a non-empty valid CXXScopeSpec.
6524
6525 /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
6526 /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
6527 /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
6528 /// Used to indicate that names should revert to being looked up in the
6529 /// defining scope.
6531
6532 /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
6533 /// initializer for the declaration 'Dcl'.
6534 /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
6535 /// static data member of class X, names should be looked up in the scope of
6536 /// class X.
6538
6539 /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
6540 /// initializer for the declaration 'Dcl'.
6541 void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
6542
6543 /// Create a new lambda closure type.
6545 TypeSourceInfo *Info,
6546 bool KnownDependent,
6547 LambdaCaptureDefault CaptureDefault);
6548
6549 /// Start the definition of a lambda expression.
6551 SourceRange IntroducerRange,
6552 TypeSourceInfo *MethodType,
6553 SourceLocation EndLoc,
6555 ConstexprSpecKind ConstexprKind,
6556 Expr *TrailingRequiresClause);
6557
6558 /// Number lambda for linkage purposes if necessary.
6560 CXXRecordDecl *Class, CXXMethodDecl *Method,
6561 Optional<std::tuple<bool, unsigned, unsigned, Decl *>> Mangling = None);
6562
6563 /// Endow the lambda scope info with the relevant properties.
6565 CXXMethodDecl *CallOperator,
6566 SourceRange IntroducerRange,
6567 LambdaCaptureDefault CaptureDefault,
6568 SourceLocation CaptureDefaultLoc,
6569 bool ExplicitParams,
6570 bool ExplicitResultType,
6571 bool Mutable);
6572
6573 /// Perform initialization analysis of the init-capture and perform
6574 /// any implicit conversions such as an lvalue-to-rvalue conversion if
6575 /// not being used to initialize a reference.
6577 SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
6578 IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init) {
6580 Loc, ByRef, EllipsisLoc, None, Id,
6581 InitKind != LambdaCaptureInitKind::CopyInit, Init));
6582 }
6584 SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
6585 Optional<unsigned> NumExpansions, IdentifierInfo *Id, bool DirectInit,
6586 Expr *&Init);
6587
6588 /// Create a dummy variable within the declcontext of the lambda's
6589 /// call operator, for name lookup purposes for a lambda init capture.
6590 ///
6591 /// CodeGen handles emission of lambda captures, ignoring these dummy
6592 /// variables appropriately.
6594 QualType InitCaptureType,
6595 SourceLocation EllipsisLoc,
6597 unsigned InitStyle, Expr *Init);
6598
6599 /// Add an init-capture to a lambda scope.
6601
6602 /// Note that we have finished the explicit captures for the
6603 /// given lambda.
6605
6606 /// \brief This is called after parsing the explicit template parameter list
6607 /// on a lambda (if it exists) in C++2a.
6609 ArrayRef<NamedDecl *> TParams,
6610 SourceLocation RAngleLoc,
6611 ExprResult RequiresClause);
6612
6613 /// Introduce the lambda parameters into scope.
6616 CXXMethodDecl *CallOperator, Scope *CurScope);
6617
6618 /// Deduce a block or lambda's return type based on the return
6619 /// statements present in the body.
6621
6622 /// ActOnStartOfLambdaDefinition - This is called just before we start
6623 /// parsing the body of a lambda; it analyzes the explicit captures and
6624 /// arguments, and sets up various data-structures for the body of the
6625 /// lambda.
6627 Declarator &ParamInfo, Scope *CurScope);
6628
6629 /// ActOnLambdaError - If there is an error parsing a lambda, this callback
6630 /// is invoked to pop the information about the lambda.
6631 void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
6632 bool IsInstantiation = false);
6633
6634 /// ActOnLambdaExpr - This is called when the body of a lambda expression
6635 /// was successfully completed.
6637 Scope *CurScope);
6638
6639 /// Does copying/destroying the captured variable have side effects?
6640 bool CaptureHasSideEffects(const sema::Capture &From);
6641
6642 /// Diagnose if an explicit lambda capture is unused. Returns true if a
6643 /// diagnostic is emitted.
6644 bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange,
6645 const sema::Capture &From);
6646
6647 /// Build a FieldDecl suitable to hold the given capture.
6649
6650 /// Initialize the given capture with a suitable expression.
6652 SourceLocation ImplicitCaptureLoc,
6653 bool IsOpenMPMapping = false);
6654
6655 /// Complete a lambda-expression having processed and attached the
6656 /// lambda body.
6659
6660 /// Get the return type to use for a lambda's conversion function(s) to
6661 /// function pointer type, given the type of the call operator.
6662 QualType
6664 CallingConv CC);
6665
6666 /// Define the "body" of the conversion from a lambda object to a
6667 /// function pointer.
6668 ///
6669 /// This routine doesn't actually define a sensible body; rather, it fills
6670 /// in the initialization expression needed to copy the lambda object into
6671 /// the block, and IR generation actually generates the real body of the
6672 /// block pointer conversion.
6674 SourceLocation CurrentLoc, CXXConversionDecl *Conv);
6675
6676 /// Define the "body" of the conversion from a lambda object to a
6677 /// block pointer.
6678 ///
6679 /// This routine doesn't actually define a sensible body; rather, it fills
6680 /// in the initialization expression needed to copy the lambda object into
6681 /// the block, and IR generation actually generates the real body of the
6682 /// block pointer conversion.
6684 CXXConversionDecl *Conv);
6685
6687 SourceLocation ConvLocation,
6688 CXXConversionDecl *Conv,
6689 Expr *Src);
6690
6691 /// Check whether the given expression is a valid constraint expression.
6692 /// A diagnostic is emitted if it is not, false is returned, and
6693 /// PossibleNonPrimary will be set to true if the failure might be due to a
6694 /// non-primary expression being used as an atomic constraint.
6695 bool CheckConstraintExpression(const Expr *CE, Token NextToken = Token(),
6696 bool *PossibleNonPrimary = nullptr,
6697 bool IsTrailingRequiresClause = false);
6698
6699private:
6700 /// Caches pairs of template-like decls whose associated constraints were
6701 /// checked for subsumption and whether or not the first's constraints did in
6702 /// fact subsume the second's.
6703 llvm::DenseMap<std::pair<NamedDecl *, NamedDecl *>, bool> SubsumptionCache;
6704 /// Caches the normalized associated constraints of declarations (concepts or
6705 /// constrained declarations). If an error occurred while normalizing the
6706 /// associated constraints of the template or concept, nullptr will be cached
6707 /// here.
6708 llvm::DenseMap<NamedDecl *, NormalizedConstraint *>
6709 NormalizationCache;
6710
6711 llvm::ContextualFoldingSet<ConstraintSatisfaction, const ASTContext &>
6712 SatisfactionCache;
6713
6714public:
6715 const NormalizedConstraint *
6717 NamedDecl *ConstrainedDecl, ArrayRef<const Expr *> AssociatedConstraints);
6718
6719 /// \brief Check whether the given declaration's associated constraints are
6720 /// at least as constrained than another declaration's according to the
6721 /// partial ordering of constraints.
6722 ///
6723 /// \param Result If no error occurred, receives the result of true if D1 is
6724 /// at least constrained than D2, and false otherwise.
6725 ///
6726 /// \returns true if an error occurred, false otherwise.
6729 bool &Result);
6730
6731 /// If D1 was not at least as constrained as D2, but would've been if a pair
6732 /// of atomic constraints involved had been declared in a concept and not
6733 /// repeated in two separate places in code.
6734 /// \returns true if such a diagnostic was emitted, false otherwise.
6737
6738 /// \brief Check whether the given list of constraint expressions are
6739 /// satisfied (as if in a 'conjunction') given template arguments.
6740 /// \param Template the template-like entity that triggered the constraints
6741 /// check (either a concept or a constrained entity).
6742 /// \param ConstraintExprs a list of constraint expressions, treated as if
6743 /// they were 'AND'ed together.
6744 /// \param TemplateArgs the list of template arguments to substitute into the
6745 /// constraint expression.
6746 /// \param TemplateIDRange The source range of the template id that
6747 /// caused the constraints check.
6748 /// \param Satisfaction if true is returned, will contain details of the
6749 /// satisfaction, with enough information to diagnose an unsatisfied
6750 /// expression.
6751 /// \returns true if an error occurred and satisfaction could not be checked,
6752 /// false otherwise.
6754 const NamedDecl *Template, ArrayRef<const Expr *> ConstraintExprs,
6755 ArrayRef<TemplateArgument> TemplateArgs,
6756 SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction);
6757
6758 /// \brief Check whether the given non-dependent constraint expression is
6759 /// satisfied. Returns false and updates Satisfaction with the satisfaction
6760 /// verdict if successful, emits a diagnostic and returns true if an error
6761 /// occured and satisfaction could not be determined.
6762 ///
6763 /// \returns true if an error occurred, false otherwise.
6764 bool CheckConstraintSatisfaction(const Expr *ConstraintExpr,
6765 ConstraintSatisfaction &Satisfaction);
6766
6767 /// Check whether the given function decl's trailing requires clause is
6768 /// satisfied, if any. Returns false and updates Satisfaction with the
6769 /// satisfaction verdict if successful, emits a diagnostic and returns true if
6770 /// an error occured and satisfaction could not be determined.
6771 ///
6772 /// \returns true if an error occurred, false otherwise.
6774 ConstraintSatisfaction &Satisfaction,
6775 SourceLocation UsageLoc = SourceLocation());
6776
6777
6778 /// \brief Ensure that the given template arguments satisfy the constraints
6779 /// associated with the given template, emitting a diagnostic if they do not.
6780 ///
6781 /// \param Template The template to which the template arguments are being
6782 /// provided.
6783 ///
6784 /// \param TemplateArgs The converted, canonicalized template arguments.
6785 ///
6786 /// \param TemplateIDRange The source range of the template id that
6787 /// caused the constraints check.
6788 ///
6789 /// \returns true if the constrains are not satisfied or could not be checked
6790 /// for satisfaction, false if the constraints are satisfied.
6792 ArrayRef<TemplateArgument> TemplateArgs,
6793 SourceRange TemplateIDRange);
6794
6795 /// \brief Emit diagnostics explaining why a constraint expression was deemed
6796 /// unsatisfied.
6797 /// \param First whether this is the first time an unsatisfied constraint is
6798 /// diagnosed for this error.
6799 void
6801 bool First = true);
6802
6803 /// \brief Emit diagnostics explaining why a constraint expression was deemed
6804 /// unsatisfied.
6805 void
6807 bool First = true);
6808
6809 // ParseObjCStringLiteral - Parse Objective-C string literals.
6811 ArrayRef<Expr *> Strings);
6812
6814
6815 /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
6816 /// numeric literal expression. Type of the expression will be "NSNumber *"
6817 /// or "id" if NSNumber is unavailable.
6820 bool Value);
6822
6823 /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
6824 /// '@' prefixed parenthesized expression. The type of the expression will
6825 /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
6826 /// of ValueType, which is allowed to be a built-in numeric type, "char *",
6827 /// "const char *" or C structure with attribute 'objc_boxable'.
6829
6831 Expr *IndexExpr,
6832 ObjCMethodDecl *getterMethod,
6833 ObjCMethodDecl *setterMethod);
6834
6837
6839 TypeSourceInfo *EncodedTypeInfo,
6840 SourceLocation RParenLoc);
6842 CXXConversionDecl *Method,
6843 bool HadMultipleCandidates);
6844
6846 SourceLocation EncodeLoc,
6847 SourceLocation LParenLoc,
6848 ParsedType Ty,
6849 SourceLocation RParenLoc);
6850
6851 /// ParseObjCSelectorExpression - Build selector expression for \@selector
6853 SourceLocation AtLoc,
6854 SourceLocation SelLoc,
6855 SourceLocation LParenLoc,
6856 SourceLocation RParenLoc,
6857 bool WarnMultipleSelectors);
6858
6859 /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
6861 SourceLocation AtLoc,
6862 SourceLocation ProtoLoc,
6863 SourceLocation LParenLoc,
6864 SourceLocation ProtoIdLoc,
6865 SourceLocation RParenLoc);
6866
6867 //===--------------------------------------------------------------------===//
6868 // C++ Declarations
6869 //
6871 SourceLocation ExternLoc,
6872 Expr *LangStr,
6873 SourceLocation LBraceLoc);
6875 Decl *LinkageSpec,
6876 SourceLocation RBraceLoc);
6877
6878
6879 //===--------------------------------------------------------------------===//
6880 // C++ Classes
6881 //
6883 bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
6884 const CXXScopeSpec *SS = nullptr);
6886
6888 SourceLocation ColonLoc,
6889 const ParsedAttributesView &Attrs);
6890
6892 Declarator &D,
6893 MultiTemplateParamsArg TemplateParameterLists,
6894 Expr *BitfieldWidth, const VirtSpecifiers &VS,
6895 InClassInitStyle InitStyle);
6896
6899 SourceLocation EqualLoc,
6900 Expr *Init);
6901
6903 Scope *S,
6904 CXXScopeSpec &SS,
6905 IdentifierInfo *MemberOrBase,
6906 ParsedType TemplateTypeTy,
6907 const DeclSpec &DS,
6908 SourceLocation IdLoc,
6909 SourceLocation LParenLoc,
6910 ArrayRef<Expr *> Args,
6911 SourceLocation RParenLoc,
6912 SourceLocation EllipsisLoc);
6913
6915 Scope *S,
6916 CXXScopeSpec &SS,
6917 IdentifierInfo *MemberOrBase,
6918 ParsedType TemplateTypeTy,
6919 const DeclSpec &DS,
6920 SourceLocation IdLoc,
6921 Expr *InitList,
6922 SourceLocation EllipsisLoc);
6923
6925 Scope *S,
6926 CXXScopeSpec &SS,
6927 IdentifierInfo *MemberOrBase,
6928 ParsedType TemplateTypeTy,
6929 const DeclSpec &DS,
6930 SourceLocation IdLoc,
6931 Expr *Init,
6932 SourceLocation EllipsisLoc);
6933
6935 Expr *Init,
6936 SourceLocation IdLoc);
6937
6939 TypeSourceInfo *BaseTInfo,
6940 Expr *Init,
6941 CXXRecordDecl *ClassDecl,
6942 SourceLocation EllipsisLoc);
6943
6945 Expr *Init,
6946 CXXRecordDecl *ClassDecl);
6947
6950
6951 bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors,
6952 ArrayRef<CXXCtorInitializer *> Initializers = None);
6953
6954 void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
6955
6956
6957 /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
6958 /// mark all the non-trivial destructors of its members and bases as
6959 /// referenced.
6961 CXXRecordDecl *Record);
6962
6963 /// Mark destructors of virtual bases of this class referenced. In the Itanium
6964 /// C++ ABI, this is done when emitting a destructor for any non-abstract
6965 /// class. In the Microsoft C++ ABI, this is done any time a class's
6966 /// destructor is referenced.
6968 SourceLocation Location, CXXRecordDecl *ClassDecl,
6969 llvm::SmallPtrSetImpl<const RecordType *> *DirectVirtualBases = nullptr);
6970
6971 /// Do semantic checks to allow the complete destructor variant to be emitted
6972 /// when the destructor is defined in another translation unit. In the Itanium
6973 /// C++ ABI, destructor variants are emitted together. In the MS C++ ABI, they
6974 /// can be emitted in separate TUs. To emit the complete variant, run a subset
6975 /// of the checks performed when emitting a regular destructor.
6977 CXXDestructorDecl *Dtor);
6978
6979 /// The list of classes whose vtables have been used within
6980 /// this translation unit, and the source locations at which the
6981 /// first use occurred.
6982 typedef std::pair<CXXRecordDecl*, SourceLocation> VTableUse;
6983
6984 /// The list of vtables that are required but have not yet been
6985 /// materialized.
6987
6988 /// The set of classes whose vtables have been used within
6989 /// this translation unit, and a bit that will be true if the vtable is
6990 /// required to be emitted (otherwise, it should be emitted only if needed
6991 /// by code generation).
6992 llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed;
6993
6994 /// Load any externally-stored vtable uses.
6996
6997 /// Note that the vtable for the given class was used at the
6998 /// given location.
7000 bool DefinitionRequired = false);
7001
7002 /// Mark the exception specifications of all virtual member functions
7003 /// in the given class as needed.
7005 const CXXRecordDecl *RD);
7006
7007 /// MarkVirtualMembersReferenced - Will mark all members of the given
7008 /// CXXRecordDecl referenced.
7010 bool ConstexprOnly = false);
7011
7012 /// Define all of the vtables that have been used in this
7013 /// translation unit and reference any virtual members used by those
7014 /// vtables.
7015 ///
7016 /// \returns true if any work was done, false otherwise.
7017 bool DefineUsedVTables();
7018
7020
7021 void ActOnMemInitializers(Decl *ConstructorDecl,
7022 SourceLocation ColonLoc,
7024 bool AnyErrors);
7025
7026 /// Check class-level dllimport/dllexport attribute. The caller must
7027 /// ensure that referenceDLLExportedClassMethods is called some point later
7028 /// when all outer classes of Class are complete.
7031
7033
7035 CXXRecordDecl *Class, Attr *ClassAttr,
7036 ClassTemplateSpecializationDecl *BaseTemplateSpec,
7037 SourceLocation BaseLoc);
7038
7039 /// Add gsl::Pointer attribute to std::container::iterator
7040 /// \param ND The declaration that introduces the name
7041 /// std::container::iterator. \param UnderlyingRecord The record named by ND.
7042 void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord);
7043
7044 /// Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
7046
7047 /// Add [[gsl::Pointer]] attributes for std:: types.
7049
7050 void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record);
7051
7052 /// Check that the C++ class annoated with "trivial_abi" satisfies all the
7053 /// conditions that are needed for the attribute to have an effect.
7055
7057 Decl *TagDecl, SourceLocation LBrac,
7058 SourceLocation RBrac,
7059 const ParsedAttributesView &AttrList);
7062
7064 unsigned ActOnReenterTemplateScope(Decl *Template,
7065 llvm::function_ref<Scope *()> EnterScope);
7068 void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
7073 CachedTokens &Toks);
7076
7078 Expr *AssertExpr,
7079 Expr *AssertMessageExpr,
7080 SourceLocation RParenLoc);
7082 Expr *AssertExpr,
7083 StringLiteral *AssertMessageExpr,
7084 SourceLocation RParenLoc,
7085 bool Failed);
7086
7088 SourceLocation FriendLoc,
7089 TypeSourceInfo *TSInfo);
7090 Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
7091 MultiTemplateParamsArg TemplateParams);
7093 MultiTemplateParamsArg TemplateParams);
7094
7096 StorageClass& SC);
7097 void CheckConstructor(CXXConstructorDecl *Constructor);
7099 StorageClass& SC);
7100 bool CheckDestructor(CXXDestructorDecl *Destructor);
7102 StorageClass& SC);
7105 StorageClass &SC);
7107
7109
7111 CXXSpecialMember CSM);
7113
7117 FunctionDecl *Spaceship);
7120
7121 //===--------------------------------------------------------------------===//
7122 // C++ Derived Classes
7123 //
7124
7125 /// ActOnBaseSpecifier - Parsed a base specifier
7127 SourceRange SpecifierRange,
7128 bool Virtual, AccessSpecifier Access,
7129 TypeSourceInfo *TInfo,
7130 SourceLocation EllipsisLoc);
7131
7133 SourceRange SpecifierRange,
7134 ParsedAttributes &Attrs,
7135 bool Virtual, AccessSpecifier Access,
7136 ParsedType basetype,
7137 SourceLocation BaseLoc,
7138 SourceLocation EllipsisLoc);
7139
7142 void ActOnBaseSpecifiers(Decl *ClassDecl,
7144
7147 CXXBasePaths &Paths);
7148
7149 // FIXME: I don't like this name.
7150 void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
7151
7153 SourceLocation Loc, SourceRange Range,
7154 CXXCastPath *BasePath = nullptr,
7155 bool IgnoreAccess = false);
7157 unsigned InaccessibleBaseID,
7158 unsigned AmbiguousBaseConvID,
7159 SourceLocation Loc, SourceRange Range,
7160 DeclarationName Name,
7161 CXXCastPath *BasePath,
7162 bool IgnoreAccess = false);
7163
7164 std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
7165
7167 const CXXMethodDecl *Old);
7168
7169 /// CheckOverridingFunctionReturnType - Checks whether the return types are
7170 /// covariant, according to C++ [class.virtual]p5.
7172 const CXXMethodDecl *Old);
7173
7174 /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
7175 /// spec is a subset of base spec.
7177 const CXXMethodDecl *Old);
7178
7179 bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange);
7180
7181 /// CheckOverrideControl - Check C++11 override control semantics.
7183
7184 /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
7185 /// not used in the declaration of an overriding method.
7186 void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent);
7187
7188 /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
7189 /// overrides a virtual member function marked 'final', according to
7190 /// C++11 [class.virtual]p4.
7192 const CXXMethodDecl *Old);
7193
7194
7195 //===--------------------------------------------------------------------===//
7196 // C++ Access Control
7197 //
7198
7205
7206 bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
7207 NamedDecl *PrevMemberDecl,
7208 AccessSpecifier LexicalAS);
7209
7211 DeclAccessPair FoundDecl);
7213 DeclAccessPair FoundDecl);
7215 SourceRange PlacementRange,
7216 CXXRecordDecl *NamingClass,
7217 DeclAccessPair FoundDecl,
7218 bool Diagnose = true);
7221 DeclAccessPair FoundDecl,
7222 const InitializedEntity &Entity,
7223 bool IsCopyBindingRefToTemp = false);
7226 DeclAccessPair FoundDecl,
7227 const InitializedEntity &Entity,
7228 const PartialDiagnostic &PDiag);
7230 CXXDestructorDecl *Dtor,
7231 const PartialDiagnostic &PDiag,
7232 QualType objectType = QualType());
7235 CXXRecordDecl *NamingClass,
7236 DeclAccessPair Found);
7239 CXXRecordDecl *DecomposedClass,
7240 DeclAccessPair Field);
7242 Expr *ObjectExpr,
7243 Expr *ArgExpr,
7244 DeclAccessPair FoundDecl);
7246 DeclAccessPair FoundDecl);
7248 QualType Base, QualType Derived,
7249 const CXXBasePath &Path,
7250 unsigned DiagID,
7251 bool ForceCheck = false,
7252 bool ForceUnprivileged = false);
7253 void CheckLookupAccess(const LookupResult &R);
7254 bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass,
7255 QualType BaseType);
7257 DeclAccessPair Found, QualType ObjectType,
7258 SourceLocation Loc,
7259 const PartialDiagnostic &Diag);
7261 DeclAccessPair Found,
7262 QualType ObjectType) {
7263 return isMemberAccessibleForDeletion(NamingClass, Found, ObjectType,
7264 SourceLocation(), PDiag());
7265 }
7266
7268 const MultiLevelTemplateArgumentList &TemplateArgs);
7269 void PerformDependentDiagnostics(const DeclContext *Pattern,
7270 const MultiLevelTemplateArgumentList &TemplateArgs);
7271
7273
7274 /// When true, access checking violations are treated as SFINAE
7275 /// failures rather than hard errors.
7277
7288
7291 TypeDiagnoser &Diagnoser);
7292 template <typename... Ts>
7293 bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
7294 const Ts &...Args) {
7295 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
7296 return RequireNonAbstractType(Loc, T, Diagnoser);
7297 }
7298
7299 void DiagnoseAbstractType(const CXXRecordDecl *RD);
7300
7301 //===--------------------------------------------------------------------===//
7302 // C++ Overloaded Operators [C++ 13.5]
7303 //
7304
7306
7308
7309 //===--------------------------------------------------------------------===//
7310 // C++ Templates [C++ 14]
7311 //
7313 bool AllowFunctionTemplates = true,
7314 bool AllowDependent = true);
7316 bool AllowFunctionTemplates = true,
7317 bool AllowDependent = true,
7318 bool AllowNonTemplateFunctions = false);
7319 /// Try to interpret the lookup result D as a template-name.
7320 ///
7321 /// \param D A declaration found by name lookup.
7322 /// \param AllowFunctionTemplates Whether function templates should be
7323 /// considered valid results.
7324 /// \param AllowDependent Whether unresolved using declarations (that might
7325 /// name templates) should be considered valid results.
7327 bool AllowFunctionTemplates = true,
7328 bool AllowDependent = true);
7329
7331 /// Whether and why a template name is required in this lookup.
7333 public:
7334 /// Template name is required if TemplateKWLoc is valid.
7336 : TemplateKW(TemplateKWLoc) {}
7337 /// Template name is unconditionally required.
7339
7341 return TemplateKW.getValueOr(SourceLocation());
7342 }
7344 bool isRequired() const { return TemplateKW != SourceLocation(); }
7345 explicit operator bool() const { return isRequired(); }
7346
7347 private:
7349 };
7350
7352 /// This is not assumed to be a template name.
7353 None,
7354 /// This is assumed to be a template name because lookup found nothing.
7356 /// This is assumed to be a template name because lookup found one or more
7357 /// functions (but no function templates).
7359 };
7360 bool LookupTemplateName(
7361 LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType,
7362 bool EnteringContext, bool &MemberOfUnknownSpecialization,
7363 RequiredTemplateKind RequiredTemplate = SourceLocation(),
7364 AssumedTemplateKind *ATK = nullptr, bool AllowTypoCorrection = true);
7365
7367 CXXScopeSpec &SS,
7368 bool hasTemplateKeyword,
7369 const UnqualifiedId &Name,
7370 ParsedType ObjectType,
7371 bool EnteringContext,
7372 TemplateTy &Template,
7373 bool &MemberOfUnknownSpecialization,
7374 bool Disambiguation = false);
7375
7376 /// Try to resolve an undeclared template name as a type template.
7377 ///
7378 /// Sets II to the identifier corresponding to the template name, and updates
7379 /// Name to a corresponding (typo-corrected) type template name and TNK to
7380 /// the corresponding kind, if possible.
7382 TemplateNameKind &TNK,
7383 SourceLocation NameLoc,
7384 IdentifierInfo *&II);
7385
7387 SourceLocation NameLoc,
7388 bool Diagnose = true);
7389
7390 /// Determine whether a particular identifier might be the name in a C++1z
7391 /// deduction-guide declaration.
7392 bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name,
7393 SourceLocation NameLoc,
7394 ParsedTemplateTy *Template = nullptr);
7395
7397 SourceLocation IILoc,
7398 Scope *S,
7399 const CXXScopeSpec *SS,
7400 TemplateTy &SuggestedTemplate,
7401 TemplateNameKind &SuggestedKind);
7402
7403 bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation,
7404 NamedDecl *Instantiation,
7405 bool InstantiatedFromMember,
7406 const NamedDecl *Pattern,
7407 const NamedDecl *PatternDef,
7409 bool Complain = true);
7410
7413
7414 NamedDecl *ActOnTypeParameter(Scope *S, bool Typename,
7415 SourceLocation EllipsisLoc,
7416 SourceLocation KeyLoc,
7417 IdentifierInfo *ParamName,
7418 SourceLocation ParamNameLoc,
7419 unsigned Depth, unsigned Position,
7420 SourceLocation EqualLoc,
7421 ParsedType DefaultArg, bool HasTypeConstraint);
7422
7423 bool ActOnTypeConstraint(const CXXScopeSpec &SS,
7425 TemplateTypeParmDecl *ConstrainedParameter,
7426 SourceLocation EllipsisLoc);
7427
7429 DeclarationNameInfo NameInfo,
7430 ConceptDecl *NamedConcept,
7431 const TemplateArgumentListInfo *TemplateArgs,
7432 TemplateTypeParmDecl *ConstrainedParameter,
7433 SourceLocation EllipsisLoc);
7434
7436 NonTypeTemplateParmDecl *ConstrainedParameter,
7437 SourceLocation EllipsisLoc);
7438
7440
7442 SourceLocation Loc);
7444
7446 unsigned Depth,
7447 unsigned Position,
7448 SourceLocation EqualLoc,
7449 Expr *DefaultArg);
7451 SourceLocation TmpLoc,
7452 TemplateParameterList *Params,
7453 SourceLocation EllipsisLoc,
7454 IdentifierInfo *ParamName,
7455 SourceLocation ParamNameLoc,
7456 unsigned Depth,
7457 unsigned Position,
7458 SourceLocation EqualLoc,
7459 ParsedTemplateArgument DefaultArg);
7460
7462 ActOnTemplateParameterList(unsigned Depth,
7463 SourceLocation ExportLoc,
7464 SourceLocation TemplateLoc,
7465 SourceLocation LAngleLoc,
7466 ArrayRef<NamedDecl *> Params,
7467 SourceLocation RAngleLoc,
7468 Expr *RequiresClause);
7469
7470 /// The context in which we are checking a template parameter list.
7481
7483 TemplateParameterList *OldParams,
7485 SkipBodyInfo *SkipBody = nullptr);
7487 SourceLocation DeclStartLoc, SourceLocation DeclLoc,
7488 const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
7490 bool IsFriend, bool &IsMemberSpecialization, bool &Invalid,
7491 bool SuppressDiagnostic = false);
7492
7494 Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
7495 CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc,
7496 const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams,
7497 AccessSpecifier AS, SourceLocation ModulePrivateLoc,
7498 SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists,
7499 TemplateParameterList **OuterTemplateParamLists,
7500 SkipBodyInfo *SkipBody = nullptr);
7501
7503 QualType NTTPType,
7504 SourceLocation Loc);
7505
7506 /// Get a template argument mapping the given template parameter to itself,
7507 /// e.g. for X in \c template<int X>, this would return an expression template
7508 /// argument referencing X.
7510 SourceLocation Location);
7511
7514
7516
7518
7520 SourceLocation TemplateLoc,
7521 TemplateArgumentListInfo &TemplateArgs);
7522
7525 TemplateTy Template, IdentifierInfo *TemplateII,
7526 SourceLocation TemplateIILoc, SourceLocation LAngleLoc,
7527 ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc,
7528 bool IsCtorOrDtorName = false, bool IsClassName = false);
7529
7530 /// Parsed an elaborated-type-specifier that refers to a template-id,
7531 /// such as \c class T::template apply<U>.
7533 TypeSpecifierType TagSpec,
7534 SourceLocation TagLoc,
7535 CXXScopeSpec &SS,
7536 SourceLocation TemplateKWLoc,
7537 TemplateTy TemplateD,
7538 SourceLocation TemplateLoc,
7539 SourceLocation LAngleLoc,
7540 ASTTemplateArgsPtr TemplateArgsIn,
7541 SourceLocation RAngleLoc);
7542
7544 Scope *S, Declarator &D, TypeSourceInfo *DI,
7545 SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
7547
7548 /// Get the specialization of the given variable template corresponding to
7549 /// the specified argument list, or a null-but-valid result if the arguments
7550 /// are dependent.
7552 SourceLocation TemplateLoc,
7553 SourceLocation TemplateNameLoc,
7554 const TemplateArgumentListInfo &TemplateArgs);
7555
7556 /// Form a reference to the specialization of the given variable template
7557 /// corresponding to the specified argument list, or a null-but-valid result
7558 /// if the arguments are dependent.
7560 const DeclarationNameInfo &NameInfo,
7561 VarTemplateDecl *Template,
7562 SourceLocation TemplateLoc,
7563 const TemplateArgumentListInfo *TemplateArgs);
7564
7567 SourceLocation TemplateKWLoc,
7568 const DeclarationNameInfo &ConceptNameInfo,
7569 NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
7570 const TemplateArgumentListInfo *TemplateArgs);
7571
7573
7575 SourceLocation TemplateKWLoc,
7576 LookupResult &R,
7577 bool RequiresADL,
7578 const TemplateArgumentListInfo *TemplateArgs);
7579
7581 SourceLocation TemplateKWLoc,
7582 const DeclarationNameInfo &NameInfo,
7583 const TemplateArgumentListInfo *TemplateArgs);
7584
7586 Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
7587 const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext,
7588 TemplateTy &Template, bool AllowInjectedClassName = false);
7589
7591 Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
7592 SourceLocation ModulePrivateLoc, CXXScopeSpec &SS,
7594 MultiTemplateParamsArg TemplateParameterLists,
7595 SkipBodyInfo *SkipBody = nullptr);
7596
7598 TemplateDecl *PrimaryTemplate,
7599 unsigned NumExplicitArgs,
7605
7607 MultiTemplateParamsArg TemplateParameterLists,
7608 Declarator &D);
7609
7610 bool
7613 NamedDecl *PrevDecl,
7615 SourceLocation PrevPtOfInstantiation,
7616 bool &SuppressNew);
7617
7619 const TemplateArgumentListInfo &ExplicitTemplateArgs,
7621
7623 FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs,
7624 LookupResult &Previous, bool QualifiedFriend = false);
7627
7629 Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc,
7630 unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS,
7631 TemplateTy Template, SourceLocation TemplateNameLoc,
7632 SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs,
7633 SourceLocation RAngleLoc, const ParsedAttributesView &Attr);
7634
7636 SourceLocation TemplateLoc,
7637 unsigned TagSpec, SourceLocation KWLoc,
7638 CXXScopeSpec &SS, IdentifierInfo *Name,
7639 SourceLocation NameLoc,
7640 const ParsedAttributesView &Attr);
7641
7643 SourceLocation ExternLoc,
7644 SourceLocation TemplateLoc,
7645 Declarator &D);
7646
7649 SourceLocation TemplateLoc,
7650 SourceLocation RAngleLoc,
7651 Decl *Param,
7653 &Converted,
7654 bool &HasDefaultArg);
7655
7656 /// Specifies the context in which a particular template
7657 /// argument is being checked.
7659 /// The template argument was specified in the code or was
7660 /// instantiated with some deduced template arguments.
7662
7663 /// The template argument was deduced via template argument
7664 /// deduction.
7666
7667 /// The template argument was deduced from an array bound
7668 /// via template argument deduction.
7671
7672 bool CheckTemplateArgument(NamedDecl *Param,
7674 NamedDecl *Template,
7675 SourceLocation TemplateLoc,
7676 SourceLocation RAngleLoc,
7677 unsigned ArgumentPackIndex,
7680
7681 /// Check that the given template arguments can be be provided to
7682 /// the given template, converting the arguments along the way.
7683 ///
7684 /// \param Template The template to which the template arguments are being
7685 /// provided.
7686 ///
7687 /// \param TemplateLoc The location of the template name in the source.
7688 ///
7689 /// \param TemplateArgs The list of template arguments. If the template is
7690 /// a template template parameter, this function may extend the set of
7691 /// template arguments to also include substituted, defaulted template
7692 /// arguments.
7693 ///
7694 /// \param PartialTemplateArgs True if the list of template arguments is
7695 /// intentionally partial, e.g., because we're checking just the initial
7696 /// set of template arguments.
7697 ///
7698 /// \param Converted Will receive the converted, canonicalized template
7699 /// arguments.
7700 ///
7701 /// \param UpdateArgsWithConversions If \c true, update \p TemplateArgs to
7702 /// contain the converted forms of the template arguments as written.
7703 /// Otherwise, \p TemplateArgs will not be modified.
7704 ///
7705 /// \param ConstraintsNotSatisfied If provided, and an error occured, will
7706 /// receive true if the cause for the error is the associated constraints of
7707 /// the template not being satisfied by the template arguments.
7708 ///
7709 /// \returns true if an error occurred, false otherwise.
7711 SourceLocation TemplateLoc,
7712 TemplateArgumentListInfo &TemplateArgs,
7713 bool PartialTemplateArgs,
7715 bool UpdateArgsWithConversions = true,
7716 bool *ConstraintsNotSatisfied = nullptr);
7717
7721
7723 TypeSourceInfo *Arg);
7725 QualType InstantiatedParamType, Expr *Arg,
7726 TemplateArgument &Converted,
7729 TemplateParameterList *Params,
7730 TemplateArgumentLoc &Arg);
7731
7734 QualType ParamType,
7735 SourceLocation Loc);
7738 SourceLocation Loc);
7739
7740 /// Enumeration describing how template parameter lists are compared
7741 /// for equality.
7743 /// We are matching the template parameter lists of two templates
7744 /// that might be redeclarations.
7745 ///
7746 /// \code
7747 /// template<typename T> struct X;
7748 /// template<typename T> struct X;
7749 /// \endcode
7751
7752 /// We are matching the template parameter lists of two template
7753 /// template parameters as part of matching the template parameter lists
7754 /// of two templates that might be redeclarations.
7755 ///
7756 /// \code
7757 /// template<template<int I> class TT> struct X;
7758 /// template<template<int Value> class Other> struct X;
7759 /// \endcode
7761
7762 /// We are matching the template parameter lists of a template
7763 /// template argument against the template parameter lists of a template
7764 /// template parameter.
7765 ///
7766 /// \code
7767 /// template<template<int Value> class Metafun> struct X;
7768 /// template<int Value> struct integer_c;
7769 /// X<integer_c> xic;
7770 /// \endcode
7773
7776 bool Complain,
7778 SourceLocation TemplateArgLoc
7779 = SourceLocation());
7780
7781 bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
7782
7783 /// Called when the parser has parsed a C++ typename
7784 /// specifier, e.g., "typename T::type".
7785 ///
7786 /// \param S The scope in which this typename type occurs.
7787 /// \param TypenameLoc the location of the 'typename' keyword
7788 /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
7789 /// \param II the identifier we're retrieving (e.g., 'type' in the example).
7790 /// \param IdLoc the location of the identifier.
7792 ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
7793 const CXXScopeSpec &SS, const IdentifierInfo &II,
7794 SourceLocation IdLoc);
7795
7796 /// Called when the parser has parsed a C++ typename
7797 /// specifier that ends in a template-id, e.g.,
7798 /// "typename MetaFun::template apply<T1, T2>".
7799 ///
7800 /// \param S The scope in which this typename type occurs.
7801 /// \param TypenameLoc the location of the 'typename' keyword
7802 /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
7803 /// \param TemplateLoc the location of the 'template' keyword, if any.
7804 /// \param TemplateName The template name.
7805 /// \param TemplateII The identifier used to name the template.
7806 /// \param TemplateIILoc The location of the template name.
7807 /// \param LAngleLoc The location of the opening angle bracket ('<').
7808 /// \param TemplateArgs The template arguments.
7809 /// \param RAngleLoc The location of the closing angle bracket ('>').
7811 ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
7812 const CXXScopeSpec &SS,
7813 SourceLocation TemplateLoc,
7815 IdentifierInfo *TemplateII,
7816 SourceLocation TemplateIILoc,
7817 SourceLocation LAngleLoc,
7818 ASTTemplateArgsPtr TemplateArgs,
7819 SourceLocation RAngleLoc);
7820
7822 SourceLocation KeywordLoc,
7823 NestedNameSpecifierLoc QualifierLoc,
7824 const IdentifierInfo &II,
7825 SourceLocation IILoc,
7826 TypeSourceInfo **TSI,
7827 bool DeducedTSTContext);
7828
7830 SourceLocation KeywordLoc,
7831 NestedNameSpecifierLoc QualifierLoc,
7832 const IdentifierInfo &II,
7833 SourceLocation IILoc,
7834 bool DeducedTSTContext = true);
7835
7836
7838 SourceLocation Loc,
7839 DeclarationName Name);
7841
7844 TemplateParameterList *Params);
7845
7846 std::string
7848 const TemplateArgumentList &Args);
7849
7850 std::string
7852 const TemplateArgument *Args,
7853 unsigned NumArgs);
7854
7855 //===--------------------------------------------------------------------===//
7856 // C++ Concepts
7857 //===--------------------------------------------------------------------===//
7859 Scope *S, MultiTemplateParamsArg TemplateParameterLists,
7860 IdentifierInfo *Name, SourceLocation NameLoc, Expr *ConstraintExpr);
7861
7864 ArrayRef<ParmVarDecl *> LocalParameters,
7865 Scope *BodyScope);
7869 SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc,
7870 IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId);
7872 SourceLocation NoexceptLoc);
7875 Expr *E, SourceLocation NoexceptLoc, CXXScopeSpec &SS,
7876 TemplateIdAnnotation *TypeConstraint, unsigned Depth);
7880 Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc,
7885 bool IsSatisfied, SourceLocation NoexceptLoc,
7897 ArrayRef<ParmVarDecl *> LocalParameters,
7899 SourceLocation ClosingBraceLoc);
7900
7901 //===--------------------------------------------------------------------===//
7902 // C++ Variadic Templates (C++0x [temp.variadic])
7903 //===--------------------------------------------------------------------===//
7904
7905 /// Determine whether an unexpanded parameter pack might be permitted in this
7906 /// location. Useful for error recovery.
7908
7909 /// The context in which an unexpanded parameter pack is
7910 /// being diagnosed.
7911 ///
7912 /// Note that the values of this enumeration line up with the first
7913 /// argument to the \c err_unexpanded_parameter_pack diagnostic.
7915 /// An arbitrary expression.
7917
7918 /// The base type of a class type.
7920
7921 /// The type of an arbitrary declaration.
7923
7924 /// The type of a data member.
7926
7927 /// The size of a bit-field.
7929
7930 /// The expression in a static assertion.
7932
7933 /// The fixed underlying type of an enumeration.
7935
7936 /// The enumerator value.
7938
7939 /// A using declaration.
7941
7942 /// A friend declaration.
7944
7945 /// A declaration qualifier.
7947
7948 /// An initializer.
7950
7951 /// A default argument.
7953
7954 /// The type of a non-type template parameter.
7956
7957 /// The type of an exception.
7959
7960 /// Partial specialization.
7962
7963 /// Microsoft __if_exists.
7965
7966 /// Microsoft __if_not_exists.
7968
7969 /// Lambda expression.
7971
7972 /// Block expression.
7974
7975 /// A type constraint.
7977
7978 // A requirement in a requires-expression.
7980
7981 // A requires-clause.
7983 };
7984
7985 /// Diagnose unexpanded parameter packs.
7986 ///
7987 /// \param Loc The location at which we should emit the diagnostic.
7988 ///
7989 /// \param UPPC The context in which we are diagnosing unexpanded
7990 /// parameter packs.
7991 ///
7992 /// \param Unexpanded the set of unexpanded parameter packs.
7993 ///
7994 /// \returns true if an error occurred, false otherwise.
7998
7999 /// If the given type contains an unexpanded parameter pack,
8000 /// diagnose the error.
8001 ///
8002 /// \param Loc The source location where a diagnostc should be emitted.
8003 ///
8004 /// \param T The type that is being checked for unexpanded parameter
8005 /// packs.
8006 ///
8007 /// \returns true if an error occurred, false otherwise.
8010
8011 /// If the given expression contains an unexpanded parameter
8012 /// pack, diagnose the error.
8013 ///
8014 /// \param E The expression that is being checked for unexpanded
8015 /// parameter packs.
8016 ///
8017 /// \returns true if an error occurred, false otherwise.
8020
8021 /// If the given requirees-expression contains an unexpanded reference to one
8022 /// of its own parameter packs, diagnose the error.
8023 ///
8024 /// \param RE The requiress-expression that is being checked for unexpanded
8025 /// parameter packs.
8026 ///
8027 /// \returns true if an error occurred, false otherwise.
8029
8030 /// If the given nested-name-specifier contains an unexpanded
8031 /// parameter pack, diagnose the error.
8032 ///
8033 /// \param SS The nested-name-specifier that is being checked for
8034 /// unexpanded parameter packs.
8035 ///
8036 /// \returns true if an error occurred, false otherwise.
8039
8040 /// If the given name contains an unexpanded parameter pack,
8041 /// diagnose the error.
8042 ///
8043 /// \param NameInfo The name (with source location information) that
8044 /// is being checked for unexpanded parameter packs.
8045 ///
8046 /// \returns true if an error occurred, false otherwise.
8049
8050 /// If the given template name contains an unexpanded parameter pack,
8051 /// diagnose the error.
8052 ///
8053 /// \param Loc The location of the template name.
8054 ///
8055 /// \param Template The template name that is being checked for unexpanded
8056 /// parameter packs.
8057 ///
8058 /// \returns true if an error occurred, false otherwise.
8060 TemplateName Template,
8062
8063 /// If the given template argument contains an unexpanded parameter
8064 /// pack, diagnose the error.
8065 ///
8066 /// \param Arg The template argument that is being checked for unexpanded
8067 /// parameter packs.
8068 ///
8069 /// \returns true if an error occurred, false otherwise.
8072
8073 /// Collect the set of unexpanded parameter packs within the given
8074 /// template argument.
8075 ///
8076 /// \param Arg The template argument that will be traversed to find
8077 /// unexpanded parameter packs.
8080
8081 /// Collect the set of unexpanded parameter packs within the given
8082 /// template argument.
8083 ///
8084 /// \param Arg The template argument that will be traversed to find
8085 /// unexpanded parameter packs.
8088
8089 /// Collect the set of unexpanded parameter packs within the given
8090 /// type.
8091 ///
8092 /// \param T The type that will be traversed to find
8093 /// unexpanded parameter packs.
8096
8097 /// Collect the set of unexpanded parameter packs within the given
8098 /// type.
8099 ///
8100 /// \param TL The type that will be traversed to find
8101 /// unexpanded parameter packs.
8104
8105 /// Collect the set of unexpanded parameter packs within the given
8106 /// nested-name-specifier.
8107 ///
8108 /// \param NNS The nested-name-specifier that will be traversed to find
8109 /// unexpanded parameter packs.
8112
8113 /// Collect the set of unexpanded parameter packs within the given
8114 /// name.
8115 ///
8116 /// \param NameInfo The name that will be traversed to find
8117 /// unexpanded parameter packs.
8120
8121 /// Invoked when parsing a template argument followed by an
8122 /// ellipsis, which creates a pack expansion.
8123 ///
8124 /// \param Arg The template argument preceding the ellipsis, which
8125 /// may already be invalid.
8126 ///
8127 /// \param EllipsisLoc The location of the ellipsis.
8129 SourceLocation EllipsisLoc);
8130
8131 /// Invoked when parsing a type followed by an ellipsis, which
8132 /// creates a pack expansion.
8133 ///
8134 /// \param Type The type preceding the ellipsis, which will become
8135 /// the pattern of the pack expansion.
8136 ///
8137 /// \param EllipsisLoc The location of the ellipsis.
8139
8140 /// Construct a pack expansion type from the pattern of the pack
8141 /// expansion.
8143 SourceLocation EllipsisLoc,
8144 Optional<unsigned> NumExpansions);
8145
8146 /// Construct a pack expansion type from the pattern of the pack
8147 /// expansion.
8149 SourceRange PatternRange,
8150 SourceLocation EllipsisLoc,
8151 Optional<unsigned> NumExpansions);
8152
8153 /// Invoked when parsing an expression followed by an ellipsis, which
8154 /// creates a pack expansion.
8155 ///
8156 /// \param Pattern The expression preceding the ellipsis, which will become
8157 /// the pattern of the pack expansion.
8158 ///
8159 /// \param EllipsisLoc The location of the ellipsis.
8160 ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc);
8161
8162 /// Invoked when parsing an expression followed by an ellipsis, which
8163 /// creates a pack expansion.
8164 ///
8165 /// \param Pattern The expression preceding the ellipsis, which will become
8166 /// the pattern of the pack expansion.
8167 ///
8168 /// \param EllipsisLoc The location of the ellipsis.
8169 ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
8170 Optional<unsigned> NumExpansions);
8171
8172 /// Determine whether we could expand a pack expansion with the
8173 /// given set of parameter packs into separate arguments by repeatedly
8174 /// transforming the pattern.
8175 ///
8176 /// \param EllipsisLoc The location of the ellipsis that identifies the
8177 /// pack expansion.
8178 ///
8179 /// \param PatternRange The source range that covers the entire pattern of
8180 /// the pack expansion.
8181 ///
8182 /// \param Unexpanded The set of unexpanded parameter packs within the
8183 /// pattern.
8184 ///
8185 /// \param ShouldExpand Will be set to \c true if the transformer should
8186 /// expand the corresponding pack expansions into separate arguments. When
8187 /// set, \c NumExpansions must also be set.
8188 ///
8189 /// \param RetainExpansion Whether the caller should add an unexpanded
8190 /// pack expansion after all of the expanded arguments. This is used
8191 /// when extending explicitly-specified template argument packs per
8192 /// C++0x [temp.arg.explicit]p9.
8193 ///
8194 /// \param NumExpansions The number of separate arguments that will be in
8195 /// the expanded form of the corresponding pack expansion. This is both an
8196 /// input and an output parameter, which can be set by the caller if the
8197 /// number of expansions is known a priori (e.g., due to a prior substitution)
8198 /// and will be set by the callee when the number of expansions is known.
8199 /// The callee must set this value when \c ShouldExpand is \c true; it may
8200 /// set this value in other cases.
8201 ///
8202 /// \returns true if an error occurred (e.g., because the parameter packs
8203 /// are to be instantiated with arguments of different lengths), false
8204 /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
8205 /// must be set.
8207 SourceRange PatternRange,
8209 const MultiLevelTemplateArgumentList &TemplateArgs,
8210 bool &ShouldExpand,
8211 bool &RetainExpansion,
8212 Optional<unsigned> &NumExpansions);
8213
8214 /// Determine the number of arguments in the given pack expansion
8215 /// type.
8216 ///
8217 /// This routine assumes that the number of arguments in the expansion is
8218 /// consistent across all of the unexpanded parameter packs in its pattern.
8219 ///
8220 /// Returns an empty Optional if the type can't be expanded.
8222 const MultiLevelTemplateArgumentList &TemplateArgs);
8223
8224 /// Determine whether the given declarator contains any unexpanded
8225 /// parameter packs.
8226 ///
8227 /// This routine is used by the parser to disambiguate function declarators
8228 /// with an ellipsis prior to the ')', e.g.,
8229 ///
8230 /// \code
8231 /// void f(T...);
8232 /// \endcode
8233 ///
8234 /// To determine whether we have an (unnamed) function parameter pack or
8235 /// a variadic function.
8236 ///
8237 /// \returns true if the declarator contains any unexpanded parameter packs,
8238 /// false otherwise.
8240
8241 /// Returns the pattern of the pack expansion for a template argument.
8242 ///
8243 /// \param OrigLoc The template argument to expand.
8244 ///
8245 /// \param Ellipsis Will be set to the location of the ellipsis.
8246 ///
8247 /// \param NumExpansions Will be set to the number of expansions that will
8248 /// be generated from this pack expansion, if known a priori.
8250 TemplateArgumentLoc OrigLoc,
8251 SourceLocation &Ellipsis,
8252 Optional<unsigned> &NumExpansions) const;
8253
8254 /// Given a template argument that contains an unexpanded parameter pack, but
8255 /// which has already been substituted, attempt to determine the number of
8256 /// elements that will be produced once this argument is fully-expanded.
8257 ///
8258 /// This is intended for use when transforming 'sizeof...(Arg)' in order to
8259 /// avoid actually expanding the pack where possible.
8261
8262 //===--------------------------------------------------------------------===//
8263 // C++ Template Argument Deduction (C++ [temp.deduct])
8264 //===--------------------------------------------------------------------===//
8265
8266 /// Adjust the type \p ArgFunctionType to match the calling convention,
8267 /// noreturn, and optionally the exception specification of \p FunctionType.
8268 /// Deduction often wants to ignore these properties when matching function
8269 /// types.
8271 bool AdjustExceptionSpec = false);
8272
8273 /// Describes the result of template argument deduction.
8274 ///
8275 /// The TemplateDeductionResult enumeration describes the result of
8276 /// template argument deduction, as returned from
8277 /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
8278 /// structure provides additional information about the results of
8279 /// template argument deduction, e.g., the deduced template argument
8280 /// list (if successful) or the specific template parameters or
8281 /// deduced arguments that were involved in the failure.
8283 /// Template argument deduction was successful.
8285 /// The declaration was invalid; do nothing.
8287 /// Template argument deduction exceeded the maximum template
8288 /// instantiation depth (which has already been diagnosed).
8290 /// Template argument deduction did not deduce a value
8291 /// for every template parameter.
8293 /// Template argument deduction did not deduce a value for every
8294 /// expansion of an expanded template parameter pack.
8296 /// Template argument deduction produced inconsistent
8297 /// deduced values for the given template parameter.
8299 /// Template argument deduction failed due to inconsistent
8300 /// cv-qualifiers on a template parameter type that would
8301 /// otherwise be deduced, e.g., we tried to deduce T in "const T"
8302 /// but were given a non-const "X".
8304 /// Substitution of the deduced template argument values
8305 /// resulted in an error.
8307 /// After substituting deduced template arguments, a dependent
8308 /// parameter type did not match the corresponding argument.
8310 /// After substituting deduced template arguments, an element of
8311 /// a dependent parameter type did not match the corresponding element
8312 /// of the corresponding argument (when deducing from an initializer list).
8314 /// A non-depnedent component of the parameter did not match the
8315 /// corresponding component of the argument.
8317 /// When performing template argument deduction for a function
8318 /// template, there were too many call arguments.
8320 /// When performing template argument deduction for a function
8321 /// template, there were too few call arguments.
8323 /// The explicitly-specified template arguments were not valid
8324 /// template arguments for the given template.
8326 /// Checking non-dependent argument conversions failed.
8328 /// The deduced arguments did not satisfy the constraints associated
8329 /// with the template.
8331 /// Deduction failed; that's all we know.
8333 /// CUDA Target attributes do not match.
8336
8339 const TemplateArgumentList &TemplateArgs,
8341
8344 const TemplateArgumentList &TemplateArgs,
8346
8349 TemplateArgumentListInfo &ExplicitTemplateArgs,
8353
8354 /// brief A function argument from which we performed template argument
8355 // deduction for a call.
8368
8372 unsigned NumExplicitlySpecified, FunctionDecl *&Specialization,
8374 SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
8375 bool PartialOverloading = false,
8376 llvm::function_ref<bool()> CheckNonDependent = []{ return false; });
8377
8380 TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
8382 bool PartialOverloading,
8383 llvm::function_ref<bool(ArrayRef<QualType>)> CheckNonDependent);
8384
8387 TemplateArgumentListInfo *ExplicitTemplateArgs,
8388 QualType ArgFunctionType,
8391 bool IsAddressOfFunction = false);
8392
8395 QualType ToType,
8398
8401 TemplateArgumentListInfo *ExplicitTemplateArgs,
8404 bool IsAddressOfFunction = false);
8405
8406 /// Substitute Replacement for \p auto in \p TypeWithAuto
8407 QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement);
8408 /// Substitute Replacement for auto in TypeWithAuto
8410 QualType Replacement);
8411 /// Completely replace the \c auto in \p TypeWithAuto by
8412 /// \p Replacement. This does not retain any \c auto type sugar.
8413 QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement);
8415 QualType Replacement);
8416
8417 /// Result type of DeduceAutoType.
8423
8426 Optional<unsigned> DependentDeductionDepth = None,
8427 bool IgnoreConstraints = false);
8430 Optional<unsigned> DependentDeductionDepth = None,
8431 bool IgnoreConstraints = false);
8432 void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init);
8434 bool Diagnose = true);
8435
8436 /// Declare implicit deduction guides for a class template if we've
8437 /// not already done so.
8439 SourceLocation Loc);
8440
8442 TypeSourceInfo *TInfo, const InitializedEntity &Entity,
8443 const InitializationKind &Kind, MultiExprArg Init);
8444
8447 SourceRange Range, bool DirectInit,
8448 Expr *Init);
8449
8451
8453 SourceLocation ReturnLoc,
8454 Expr *&RetExpr, AutoType *AT);
8455
8458 TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1,
8459 unsigned NumCallArguments2, bool Reversed = false);
8462 TemplateSpecCandidateSet &FailedCandidates,
8463 SourceLocation Loc,
8464 const PartialDiagnostic &NoneDiag,
8465 const PartialDiagnostic &AmbigDiag,
8466 const PartialDiagnostic &CandidateDiag,
8467 bool Complain = true, QualType TargetType = QualType());
8468
8473 SourceLocation Loc);
8474
8477
8481
8484
8487
8488 void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced,
8489 unsigned Depth, llvm::SmallBitVector &Used);
8490
8491 void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
8492 bool OnlyDeduced,
8493 unsigned Depth,
8494 llvm::SmallBitVector &Used);
8497 llvm::SmallBitVector &Deduced) {
8499 }
8502 llvm::SmallBitVector &Deduced);
8503
8504 //===--------------------------------------------------------------------===//
8505 // C++ Template Instantiation
8506 //
8507
8510 const TemplateArgumentList *Innermost = nullptr,
8511 bool RelativeToPrimary = false,
8512 const FunctionDecl *Pattern = nullptr);
8513
8514 /// A context in which code is being synthesized (where a source location
8515 /// alone is not sufficient to identify the context). This covers template
8516 /// instantiation and various forms of implicitly-generated functions.
8518 /// The kind of template instantiation we are performing
8520 /// We are instantiating a template declaration. The entity is
8521 /// the declaration we're instantiating (e.g., a CXXRecordDecl).
8523
8524 /// We are instantiating a default argument for a template
8525 /// parameter. The Entity is the template parameter whose argument is
8526 /// being instantiated, the Template is the template, and the
8527 /// TemplateArgs/NumTemplateArguments provide the template arguments as
8528 /// specified.
8530
8531 /// We are instantiating a default argument for a function.
8532 /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
8533 /// provides the template arguments as specified.
8535
8536 /// We are substituting explicit template arguments provided for
8537 /// a function template. The entity is a FunctionTemplateDecl.
8539
8540 /// We are substituting template argument determined as part of
8541 /// template argument deduction for either a class template
8542 /// partial specialization or a function template. The
8543 /// Entity is either a {Class|Var}TemplatePartialSpecializationDecl or
8544 /// a TemplateDecl.
8546
8547 /// We are substituting prior template arguments into a new
8548 /// template parameter. The template parameter itself is either a
8549 /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
8551
8552 /// We are checking the validity of a default template argument that
8553 /// has been used when naming a template-id.
8555
8556 /// We are computing the exception specification for a defaulted special
8557 /// member function.
8559
8560 /// We are instantiating the exception specification for a function
8561 /// template which was deferred until it was needed.
8563
8564 /// We are instantiating a requirement of a requires expression.
8566
8567 /// We are checking the satisfaction of a nested requirement of a requires
8568 /// expression.
8570
8571 /// We are declaring an implicit special member function.
8573
8574 /// We are declaring an implicit 'operator==' for a defaulted
8575 /// 'operator<=>'.
8577
8578 /// We are defining a synthesized function (such as a defaulted special
8579 /// member).
8581
8582 // We are checking the constraints associated with a constrained entity or
8583 // the constraint expression of a concept. This includes the checks that
8584 // atomic constraints have the type 'bool' and that they can be constant
8585 // evaluated.
8587
8588 // We are substituting template arguments into a constraint expression.
8590
8591 // We are normalizing a constraint expression.
8593
8594 // We are substituting into the parameter mapping of an atomic constraint
8595 // during normalization.
8597
8598 /// We are rewriting a comparison operator in terms of an operator<=>.
8600
8601 /// We are initializing a structured binding.
8603
8604 /// We are marking a class as __dllexport.
8606
8607 /// Added for Template instantiation observation.
8608 /// Memoization means we are _not_ instantiating a template because
8609 /// it is already instantiated (but we entered a context where we
8610 /// would have had to if it was not already instantiated).
8613
8614 /// Was the enclosing context a non-instantiation SFINAE context?
8616
8617 /// The point of instantiation or synthesis within the source code.
8619
8620 /// The entity that is being synthesized.
8622
8623 /// The template (or partial specialization) in which we are
8624 /// performing the instantiation, for substitutions of prior template
8625 /// arguments.
8627
8628 /// The list of template arguments we are substituting, if they
8629 /// are not part of the entity.
8631
8632 // FIXME: Wrap this union around more members, or perhaps store the
8633 // kind-specific members in the RAII object owning the context.
8634 union {
8635 /// The number of template arguments in TemplateArgs.
8637
8638 /// The special member being declared or defined.
8640 };
8641
8643 assert(Kind != DeclaringSpecialMember);
8644 return {TemplateArgs, NumTemplateArgs};
8645 }
8646
8647 /// The template deduction info object associated with the
8648 /// substitution or checking of explicit or deduced template arguments.
8650
8651 /// The source range that covers the construct that cause
8652 /// the instantiation, e.g., the template-id that causes a class
8653 /// template instantiation.
8655
8661
8662 /// Determines whether this template is an actual instantiation
8663 /// that should be counted toward the maximum instantiation depth.
8664 bool isInstantiationRecord() const;
8665 };
8666
8667 /// List of active code synthesis contexts.
8668 ///
8669 /// This vector is treated as a stack. As synthesis of one entity requires
8670 /// synthesis of another, additional contexts are pushed onto the stack.
8672
8673 /// Specializations whose definitions are currently being instantiated.
8675
8676 /// Non-dependent types used in templates that have already been instantiated
8677 /// by some template instantiation.
8679
8680 /// Extra modules inspected when performing a lookup during a template
8681 /// instantiation. Computed lazily.
8683
8684 /// Cache of additional modules that should be used for name lookup
8685 /// within the current template instantiation. Computed lazily; use
8686 /// getLookupModules() to get a complete set.
8688
8689 /// Get the set of additional modules that should be checked during
8690 /// name lookup. A module and its imports become visible when instanting a
8691 /// template defined within it.
8693
8694 /// Map from the most recent declaration of a namespace to the most
8695 /// recent visible declaration of that namespace.
8696 llvm::DenseMap<NamedDecl*, NamedDecl*> VisibleNamespaceCache;
8697
8698 /// Whether we are in a SFINAE context that is not associated with
8699 /// template instantiation.
8700 ///
8701 /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
8702 /// of a template instantiation or template argument deduction.
8704
8705 /// The number of \p CodeSynthesisContexts that are not template
8706 /// instantiations and, therefore, should not be counted as part of the
8707 /// instantiation depth.
8708 ///
8709 /// When the instantiation depth reaches the user-configurable limit
8710 /// \p LangOptions::InstantiationDepth we will abort instantiation.
8711 // FIXME: Should we have a similar limit for other forms of synthesis?
8713
8714 /// The depth of the context stack at the point when the most recent
8715 /// error or warning was produced.
8716 ///
8717 /// This value is used to suppress printing of redundant context stacks
8718 /// when there are multiple errors or warnings in the same instantiation.
8719 // FIXME: Does this belong in Sema? It's tough to implement it anywhere else.
8721
8722 /// The template instantiation callbacks to trace or track
8723 /// instantiations (objects can be chained).
8724 ///
8725 /// This callbacks is used to print, trace or track template
8726 /// instantiations as they are being constructed.
8727 std::vector<std::unique_ptr<TemplateInstantiationCallback>>
8729
8730 /// The current index into pack expansion arguments that will be
8731 /// used for substitution of parameter packs.
8732 ///
8733 /// The pack expansion index will be -1 to indicate that parameter packs
8734 /// should be instantiated as themselves. Otherwise, the index specifies
8735 /// which argument within the parameter pack will be used for substitution.
8737
8738 /// RAII object used to change the argument pack substitution index
8739 /// within a \c Sema object.
8740 ///
8741 /// See \c ArgumentPackSubstitutionIndex for more information.
8743 Sema &Self;
8744 int OldSubstitutionIndex;
8745
8746 public:
8747 ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
8748 : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
8749 Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
8750 }
8751
8753 Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
8754 }
8755 };
8756
8758
8759 /// For each declaration that involved template argument deduction, the
8760 /// set of diagnostics that were suppressed during that template argument
8761 /// deduction.
8762 ///
8763 /// FIXME: Serialize this structure to the AST file.
8764 typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >
8767
8768 /// A stack object to be created when performing template
8769 /// instantiation.
8770 ///
8771 /// Construction of an object of type \c InstantiatingTemplate
8772 /// pushes the current instantiation onto the stack of active
8773 /// instantiations. If the size of this stack exceeds the maximum
8774 /// number of recursive template instantiations, construction
8775 /// produces an error and evaluates true.
8776 ///
8777 /// Destruction of this object will pop the named instantiation off
8778 /// the stack.
8780 /// Note that we are instantiating a class template,
8781 /// function template, variable template, alias template,
8782 /// or a member thereof.
8783 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8784 Decl *Entity,
8785 SourceRange InstantiationRange = SourceRange());
8786
8788 /// Note that we are instantiating an exception specification
8789 /// of a function template.
8790 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8792 SourceRange InstantiationRange = SourceRange());
8793
8794 /// Note that we are instantiating a default argument in a
8795 /// template-id.
8796 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8797 TemplateParameter Param, TemplateDecl *Template,
8798 ArrayRef<TemplateArgument> TemplateArgs,
8799 SourceRange InstantiationRange = SourceRange());
8800
8801 /// Note that we are substituting either explicitly-specified or
8802 /// deduced template arguments during function template argument deduction.
8803 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8805 ArrayRef<TemplateArgument> TemplateArgs,
8807 sema::TemplateDeductionInfo &DeductionInfo,
8808 SourceRange InstantiationRange = SourceRange());
8809
8810 /// Note that we are instantiating as part of template
8811 /// argument deduction for a class template declaration.
8812 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8813 TemplateDecl *Template,
8814 ArrayRef<TemplateArgument> TemplateArgs,
8815 sema::TemplateDeductionInfo &DeductionInfo,
8816 SourceRange InstantiationRange = SourceRange());
8817
8818 /// Note that we are instantiating as part of template
8819 /// argument deduction for a class template partial
8820 /// specialization.
8821 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8823 ArrayRef<TemplateArgument> TemplateArgs,
8824 sema::TemplateDeductionInfo &DeductionInfo,
8825 SourceRange InstantiationRange = SourceRange());
8826
8827 /// Note that we are instantiating as part of template
8828 /// argument deduction for a variable template partial
8829 /// specialization.
8830 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8832 ArrayRef<TemplateArgument> TemplateArgs,
8833 sema::TemplateDeductionInfo &DeductionInfo,
8834 SourceRange InstantiationRange = SourceRange());
8835
8836 /// Note that we are instantiating a default argument for a function
8837 /// parameter.
8838 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8839 ParmVarDecl *Param,
8840 ArrayRef<TemplateArgument> TemplateArgs,
8841 SourceRange InstantiationRange = SourceRange());
8842
8843 /// Note that we are substituting prior template arguments into a
8844 /// non-type parameter.
8845 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8846 NamedDecl *Template,
8848 ArrayRef<TemplateArgument> TemplateArgs,
8849 SourceRange InstantiationRange);
8850
8851 /// Note that we are substituting prior template arguments into a
8852 /// template template parameter.
8853 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8854 NamedDecl *Template,
8856 ArrayRef<TemplateArgument> TemplateArgs,
8857 SourceRange InstantiationRange);
8858
8859 /// Note that we are checking the default template argument
8860 /// against the template parameter for a given template-id.
8861 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8862 TemplateDecl *Template,
8863 NamedDecl *Param,
8864 ArrayRef<TemplateArgument> TemplateArgs,
8865 SourceRange InstantiationRange);
8866
8868 /// \brief Note that we are checking the constraints associated with some
8869 /// constrained entity (a concept declaration or a template with associated
8870 /// constraints).
8871 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8872 ConstraintsCheck, NamedDecl *Template,
8873 ArrayRef<TemplateArgument> TemplateArgs,
8874 SourceRange InstantiationRange);
8875
8877 /// \brief Note that we are checking a constraint expression associated
8878 /// with a template declaration or as part of the satisfaction check of a
8879 /// concept.
8880 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8882 sema::TemplateDeductionInfo &DeductionInfo,
8883 SourceRange InstantiationRange);
8884
8886 /// \brief Note that we are normalizing a constraint expression.
8887 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8889 SourceRange InstantiationRange);
8890
8892 /// \brief Note that we are subtituting into the parameter mapping of an
8893 /// atomic constraint during constraint normalization.
8894 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8896 SourceRange InstantiationRange);
8897
8898 /// \brief Note that we are substituting template arguments into a part of
8899 /// a requirement of a requires expression.
8900 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8902 sema::TemplateDeductionInfo &DeductionInfo,
8903 SourceRange InstantiationRange = SourceRange());
8904
8905 /// \brief Note that we are checking the satisfaction of the constraint
8906 /// expression inside of a nested requirement.
8907 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
8909 SourceRange InstantiationRange = SourceRange());
8910
8911 /// Note that we have finished instantiating this template.
8912 void Clear();
8913
8915
8916 /// Determines whether we have exceeded the maximum
8917 /// recursive template instantiations.
8918 bool isInvalid() const { return Invalid; }
8919
8920 /// Determine whether we are already instantiating this
8921 /// specialization in some surrounding active instantiation.
8922 bool isAlreadyInstantiating() const { return AlreadyInstantiating; }
8923
8924 private:
8925 Sema &SemaRef;
8926 bool Invalid;
8927 bool AlreadyInstantiating;
8928 bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
8929 SourceRange InstantiationRange);
8930
8933 SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
8934 Decl *Entity, NamedDecl *Template = nullptr,
8935 ArrayRef<TemplateArgument> TemplateArgs = None,
8936 sema::TemplateDeductionInfo *DeductionInfo = nullptr);
8937
8939
8941 operator=(const InstantiatingTemplate&) = delete;
8942 };
8943
8944 void pushCodeSynthesisContext(CodeSynthesisContext Ctx);
8946
8947 /// Determine whether we are currently performing template instantiation.
8950 }
8951
8962
8964
8965 /// Determines whether we are currently in a context where
8966 /// template argument substitution failures are not considered
8967 /// errors.
8968 ///
8969 /// \returns An empty \c Optional if we're not in a SFINAE context.
8970 /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
8971 /// template-deduction context object, which can be used to capture
8972 /// diagnostics that will be suppressed.
8974
8975 /// Determines whether we are currently in a context that
8976 /// is not evaluated as per C++ [expr] p5.
8978 assert(!ExprEvalContexts.empty() &&
8979 "Must be in an expression evaluation context");
8980 return ExprEvalContexts.back().isUnevaluated();
8981 }
8982
8983 /// RAII class used to determine whether SFINAE has
8984 /// trapped any errors that occur during template argument
8985 /// deduction.
8987 Sema &SemaRef;
8988 unsigned PrevSFINAEErrors;
8989 bool PrevInNonInstantiationSFINAEContext;
8990 bool PrevAccessCheckingSFINAE;
8991 bool PrevLastDiagnosticIgnored;
8992
8993 public:
8994 explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
8995 : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
8996 PrevInNonInstantiationSFINAEContext(
8998 PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE),
8999 PrevLastDiagnosticIgnored(
9000 SemaRef.getDiagnostics().isLastDiagnosticIgnored())
9001 {
9002 if (!SemaRef.isSFINAEContext())
9003 SemaRef.InNonInstantiationSFINAEContext = true;
9005 }
9006
9008 SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
9010 = PrevInNonInstantiationSFINAEContext;
9011 SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
9013 PrevLastDiagnosticIgnored);
9014 }
9015
9016 /// Determine whether any SFINAE errors have been trapped.
9017 bool hasErrorOccurred() const {
9018 return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
9019 }
9020 };
9021
9022 /// RAII class used to indicate that we are performing provisional
9023 /// semantic analysis to determine the validity of a construct, so
9024 /// typo-correction and diagnostics in the immediate context (not within
9025 /// implicitly-instantiated templates) should be suppressed.
9027 Sema &SemaRef;
9028 // FIXME: Using a SFINAETrap for this is a hack.
9029 SFINAETrap Trap;
9030 bool PrevDisableTypoCorrection;
9031 public:
9032 explicit TentativeAnalysisScope(Sema &SemaRef)
9033 : SemaRef(SemaRef), Trap(SemaRef, true),
9034 PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
9035 SemaRef.DisableTypoCorrection = true;
9036 }
9038 SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
9039 }
9040 };
9041
9042 /// The current instantiation scope used to store local
9043 /// variables.
9045
9046 /// Tracks whether we are in a context where typo correction is
9047 /// disabled.
9049
9050 /// The number of typos corrected by CorrectTypo.
9052
9053 typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
9054 typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
9055
9056 /// A cache containing identifiers for which typo correction failed and
9057 /// their locations, so that repeated attempts to correct an identifier in a
9058 /// given location are ignored if typo correction already failed for it.
9060
9061 /// Worker object for performing CFG-based warnings.
9064
9065 /// An entity for which implicit template instantiation is required.
9066 ///
9067 /// The source location associated with the declaration is the first place in
9068 /// the source code where the declaration was "used". It is not necessarily
9069 /// the point of instantiation (which will be either before or after the
9070 /// namespace-scope declaration that triggered this implicit instantiation),
9071 /// However, it is the location that diagnostics should generally refer to,
9072 /// because users will need to know what code triggered the instantiation.
9073 typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
9074
9075 /// The queue of implicit template instantiations that are required
9076 /// but have not yet been performed.
9077 std::deque<PendingImplicitInstantiation> PendingInstantiations;
9078
9079 /// Queue of implicit template instantiations that cannot be performed
9080 /// eagerly.
9082
9084 public:
9086 : S(S), Enabled(Enabled) {
9087 if (!Enabled) return;
9088
9089 SavedPendingInstantiations.swap(S.PendingInstantiations);
9090 SavedVTableUses.swap(S.VTableUses);
9091 }
9092
9093 void perform() {
9094 if (Enabled) {
9095 S.DefineUsedVTables();
9096 S.PerformPendingInstantiations();
9097 }
9098 }
9099
9101 if (!Enabled) return;
9102
9103 // Restore the set of pending vtables.
9104 assert(S.VTableUses.empty() &&
9105 "VTableUses should be empty before it is discarded.");
9106 S.VTableUses.swap(SavedVTableUses);
9107
9108 // Restore the set of pending implicit instantiations.
9109 if (S.TUKind != TU_Prefix || !S.LangOpts.PCHInstantiateTemplates) {
9110 assert(S.PendingInstantiations.empty() &&
9111 "PendingInstantiations should be empty before it is discarded.");
9112 S.PendingInstantiations.swap(SavedPendingInstantiations);
9113 } else {
9114 // Template instantiations in the PCH may be delayed until the TU.
9115 S.PendingInstantiations.swap(SavedPendingInstantiations);
9116 S.PendingInstantiations.insert(S.PendingInstantiations.end(),
9117 SavedPendingInstantiations.begin(),
9118 SavedPendingInstantiations.end());
9119 }
9120 }
9121
9122 private:
9123 Sema &S;
9124 SmallVector<VTableUse, 16> SavedVTableUses;
9125 std::deque<PendingImplicitInstantiation> SavedPendingInstantiations;
9126 bool Enabled;
9127 };
9128
9129 /// The queue of implicit template instantiations that are required
9130 /// and must be performed within the current local scope.
9131 ///
9132 /// This queue is only used for member functions of local classes in
9133 /// templates, which must be instantiated in the same scope as their
9134 /// enclosing function, so that they can reference function-local
9135 /// types, static variables, enumerators, etc.
9136 std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations;
9137
9139 public:
9141 SavedPendingLocalImplicitInstantiations.swap(
9142 S.PendingLocalImplicitInstantiations);
9143 }
9144
9145 void perform() { S.PerformPendingInstantiations(/*LocalOnly=*/true); }
9146
9148 assert(S.PendingLocalImplicitInstantiations.empty() &&
9149 "there shouldn't be any pending local implicit instantiations");
9150 SavedPendingLocalImplicitInstantiations.swap(
9151 S.PendingLocalImplicitInstantiations);
9152 }
9153
9154 private:
9155 Sema &S;
9156 std::deque<PendingImplicitInstantiation>
9157 SavedPendingLocalImplicitInstantiations;
9158 };
9159
9160 /// A helper class for building up ExtParameterInfos.
9163 bool HasInteresting = false;
9164
9165 public:
9166 /// Set the ExtParameterInfo for the parameter at the given index,
9167 ///
9168 void set(unsigned index, FunctionProtoType::ExtParameterInfo info) {
9169 assert(Infos.size() <= index);
9170 Infos.resize(index);
9171 Infos.push_back(info);
9172
9173 if (!HasInteresting)
9174 HasInteresting = (info != FunctionProtoType::ExtParameterInfo());
9175 }
9176
9177 /// Return a pointer (suitable for setting in an ExtProtoInfo) to the
9178 /// ExtParameterInfo array we've built up.
9180 getPointerOrNull(unsigned numParams) {
9181 if (!HasInteresting) return nullptr;
9182 Infos.resize(numParams);
9183 return Infos.data();
9184 }
9185 };
9186
9187 void PerformPendingInstantiations(bool LocalOnly = false);
9188
9190 const MultiLevelTemplateArgumentList &TemplateArgs,
9191 SourceLocation Loc, DeclarationName Entity,
9192 bool AllowDeducedTST = false);
9193
9195 const MultiLevelTemplateArgumentList &TemplateArgs,
9196 SourceLocation Loc, DeclarationName Entity);
9197
9199 const MultiLevelTemplateArgumentList &TemplateArgs,
9200 SourceLocation Loc, DeclarationName Entity);
9201
9203 const MultiLevelTemplateArgumentList &TemplateArgs,
9204 SourceLocation Loc,
9205 DeclarationName Entity,
9206 CXXRecordDecl *ThisContext,
9207 Qualifiers ThisTypeQuals);
9208 void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto,
9209 const MultiLevelTemplateArgumentList &Args);
9212 SmallVectorImpl<QualType> &ExceptionStorage,
9213 const MultiLevelTemplateArgumentList &Args);
9215 const MultiLevelTemplateArgumentList &TemplateArgs,
9216 int indexAdjustment,
9217 Optional<unsigned> NumExpansions,
9218 bool ExpectParameterPack);
9220 const FunctionProtoType::ExtParameterInfo *ExtParamInfos,
9221 const MultiLevelTemplateArgumentList &TemplateArgs,
9222 SmallVectorImpl<QualType> &ParamTypes,
9224 ExtParameterInfoBuilder &ParamInfos);
9226 const MultiLevelTemplateArgumentList &TemplateArgs);
9227
9228 /// Substitute the given template arguments into a list of
9229 /// expressions, expanding pack expansions if required.
9230 ///
9231 /// \param Exprs The list of expressions to substitute into.
9232 ///
9233 /// \param IsCall Whether this is some form of call, in which case
9234 /// default arguments will be dropped.
9235 ///
9236 /// \param TemplateArgs The set of template arguments to substitute.
9237 ///
9238 /// \param Outputs Will receive all of the substituted arguments.
9239 ///
9240 /// \returns true if an error occurred, false otherwise.
9241 bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall,
9242 const MultiLevelTemplateArgumentList &TemplateArgs,
9243 SmallVectorImpl<Expr *> &Outputs);
9244
9246 const MultiLevelTemplateArgumentList &TemplateArgs);
9247
9250 const MultiLevelTemplateArgumentList &TemplateArgs);
9251
9252 bool
9254 const MultiLevelTemplateArgumentList &TemplateArgs,
9255 TemplateArgumentListInfo &Outputs);
9256
9257
9258 Decl *SubstDecl(Decl *D, DeclContext *Owner,
9259 const MultiLevelTemplateArgumentList &TemplateArgs);
9260
9261 /// Substitute the name and return type of a defaulted 'operator<=>' to form
9262 /// an implicit 'operator=='.
9264 FunctionDecl *Spaceship);
9265
9267 const MultiLevelTemplateArgumentList &TemplateArgs,
9268 bool CXXDirectInit);
9269
9270 bool
9271 SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
9272 CXXRecordDecl *Pattern,
9273 const MultiLevelTemplateArgumentList &TemplateArgs);
9274
9275 bool
9276 InstantiateClass(SourceLocation PointOfInstantiation,
9277 CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
9278 const MultiLevelTemplateArgumentList &TemplateArgs,
9280 bool Complain = true);
9281
9282 bool InstantiateEnum(SourceLocation PointOfInstantiation,
9283 EnumDecl *Instantiation, EnumDecl *Pattern,
9284 const MultiLevelTemplateArgumentList &TemplateArgs,
9286
9288 SourceLocation PointOfInstantiation, FieldDecl *Instantiation,
9289 FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs);
9290
9302
9303 void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
9304 const Decl *Pattern, Decl *Inst,
9305 LateInstantiatedAttrVec *LateAttrs = nullptr,
9306 LocalInstantiationScope *OuterMostScope = nullptr);
9307
9308 void
9310 const Decl *Pattern, Decl *Inst,
9311 LateInstantiatedAttrVec *LateAttrs = nullptr,
9312 LocalInstantiationScope *OuterMostScope = nullptr);
9313
9315
9317 SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec);
9318
9319 bool
9321 ClassTemplateSpecializationDecl *ClassTemplateSpec,
9323 bool Complain = true);
9324
9325 void InstantiateClassMembers(SourceLocation PointOfInstantiation,
9326 CXXRecordDecl *Instantiation,
9327 const MultiLevelTemplateArgumentList &TemplateArgs,
9329
9331 SourceLocation PointOfInstantiation,
9332 ClassTemplateSpecializationDecl *ClassTemplateSpec,
9334
9337 const MultiLevelTemplateArgumentList &TemplateArgs);
9338
9341 const MultiLevelTemplateArgumentList &TemplateArgs);
9344 SourceLocation Loc,
9345 const MultiLevelTemplateArgumentList &TemplateArgs);
9346 bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs,
9348 const MultiLevelTemplateArgumentList &TemplateArgs);
9349
9351 ParmVarDecl *Param);
9352 void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
9353 FunctionDecl *Function);
9355 SourceLocation PointOfInstantiation, FunctionDecl *Decl,
9356 ArrayRef<TemplateArgument> TemplateArgs,
9357 ConstraintSatisfaction &Satisfaction);
9359 const TemplateArgumentList *Args,
9360 SourceLocation Loc);
9361 void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
9362 FunctionDecl *Function,
9363 bool Recursive = false,
9364 bool DefinitionRequired = false,
9365 bool AtEndOfTU = false);
9368 const TemplateArgumentList &TemplateArgList,
9369 const TemplateArgumentListInfo &TemplateArgsInfo,
9371 SourceLocation PointOfInstantiation,
9372 LateInstantiatedAttrVec *LateAttrs = nullptr,
9373 LocalInstantiationScope *StartingScope = nullptr);
9375 VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
9376 const MultiLevelTemplateArgumentList &TemplateArgs);
9377 void
9379 const MultiLevelTemplateArgumentList &TemplateArgs,
9380 LateInstantiatedAttrVec *LateAttrs,
9381 DeclContext *Owner,
9382 LocalInstantiationScope *StartingScope,
9383 bool InstantiatingVarTemplate = false,
9384 VarTemplateSpecializationDecl *PrevVTSD = nullptr);
9385
9387 VarDecl *Var, VarDecl *OldVar,
9388 const MultiLevelTemplateArgumentList &TemplateArgs);
9389 void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
9390 VarDecl *Var, bool Recursive = false,
9391 bool DefinitionRequired = false,
9392 bool AtEndOfTU = false);
9393
9395 const CXXConstructorDecl *Tmpl,
9396 const MultiLevelTemplateArgumentList &TemplateArgs);
9397
9399 const MultiLevelTemplateArgumentList &TemplateArgs,
9400 bool FindingInstantiatedContext = false);
9402 const MultiLevelTemplateArgumentList &TemplateArgs);
9403
9404 // Objective-C declarations.
9415
9417 ObjCTypeParamVariance variance,
9418 SourceLocation varianceLoc,
9419 unsigned index,
9420 IdentifierInfo *paramName,
9421 SourceLocation paramLoc,
9422 SourceLocation colonLoc,
9423 ParsedType typeBound);
9424
9426 ArrayRef<Decl *> typeParams,
9427 SourceLocation rAngleLoc);
9428 void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
9429
9431 Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
9432 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
9433 IdentifierInfo *SuperName, SourceLocation SuperLoc,
9434 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
9435 Decl *const *ProtoRefs, unsigned NumProtoRefs,
9436 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
9437 const ParsedAttributesView &AttrList);
9438
9440 SourceLocation AtInterfaceLoc,
9441 ObjCInterfaceDecl *IDecl,
9442 IdentifierInfo *ClassName,
9443 SourceLocation ClassLoc,
9444 IdentifierInfo *SuperName,
9445 SourceLocation SuperLoc,
9446 ArrayRef<ParsedType> SuperTypeArgs,
9447 SourceRange SuperTypeArgsRange);
9448
9450 SmallVectorImpl<SourceLocation> &ProtocolLocs,
9451 IdentifierInfo *SuperName,
9452 SourceLocation SuperLoc);
9453
9455 SourceLocation AtCompatibilityAliasLoc,
9456 IdentifierInfo *AliasName, SourceLocation AliasLocation,
9457 IdentifierInfo *ClassName, SourceLocation ClassLocation);
9458
9460 IdentifierInfo *PName,
9461 SourceLocation &PLoc, SourceLocation PrevLoc,
9462 const ObjCList<ObjCProtocolDecl> &PList);
9463
9465 SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
9466 SourceLocation ProtocolLoc, Decl *const *ProtoRefNames,
9467 unsigned NumProtoRefs, const SourceLocation *ProtoLocs,
9468 SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList);
9469
9471 SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
9472 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
9473 IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
9474 Decl *const *ProtoRefs, unsigned NumProtoRefs,
9475 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
9476 const ParsedAttributesView &AttrList);
9477
9479 IdentifierInfo *ClassName,
9480 SourceLocation ClassLoc,
9481 IdentifierInfo *SuperClassname,
9482 SourceLocation SuperClassLoc,
9483 const ParsedAttributesView &AttrList);
9484
9486 IdentifierInfo *ClassName,
9487 SourceLocation ClassLoc,
9488 IdentifierInfo *CatName,
9489 SourceLocation CatLoc,
9490 const ParsedAttributesView &AttrList);
9491
9493 ArrayRef<Decl *> Decls);
9494
9496 IdentifierInfo **IdentList,
9497 SourceLocation *IdentLocs,
9498 ArrayRef<ObjCTypeParamList *> TypeParamLists,
9499 unsigned NumElts);
9500
9504 const ParsedAttributesView &attrList);
9505
9506 void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
9507 ArrayRef<IdentifierLocPair> ProtocolId,
9508 SmallVectorImpl<Decl *> &Protocols);
9509
9511 SourceLocation ProtocolLoc,
9512 IdentifierInfo *TypeArgId,
9513 SourceLocation TypeArgLoc,
9514 bool SelectProtocolFirst = false);
9515
9516 /// Given a list of identifiers (and their locations), resolve the
9517 /// names to either Objective-C protocol qualifiers or type
9518 /// arguments, as appropriate.
9520 Scope *S,
9521 ParsedType baseType,
9522 SourceLocation lAngleLoc,
9523 ArrayRef<IdentifierInfo *> identifiers,
9524 ArrayRef<SourceLocation> identifierLocs,
9525 SourceLocation rAngleLoc,
9526 SourceLocation &typeArgsLAngleLoc,
9528 SourceLocation &typeArgsRAngleLoc,
9529 SourceLocation &protocolLAngleLoc,
9530 SmallVectorImpl<Decl *> &protocols,
9531 SourceLocation &protocolRAngleLoc,
9532 bool warnOnIncompleteProtocols);
9533
9534 /// Build a an Objective-C protocol-qualified 'id' type where no
9535 /// base type was specified.
9537 SourceLocation lAngleLoc,
9538 ArrayRef<Decl *> protocols,
9539 ArrayRef<SourceLocation> protocolLocs,
9540 SourceLocation rAngleLoc);
9541
9542 /// Build a specialized and/or protocol-qualified Objective-C type.
9544 Scope *S,
9545 SourceLocation Loc,
9546 ParsedType BaseType,
9547 SourceLocation TypeArgsLAngleLoc,
9548 ArrayRef<ParsedType> TypeArgs,
9549 SourceLocation TypeArgsRAngleLoc,
9550 SourceLocation ProtocolLAngleLoc,
9551 ArrayRef<Decl *> Protocols,
9552 ArrayRef<SourceLocation> ProtocolLocs,
9553 SourceLocation ProtocolRAngleLoc);
9554
9555 /// Build an Objective-C type parameter type.
9557 SourceLocation ProtocolLAngleLoc,
9559 ArrayRef<SourceLocation> ProtocolLocs,
9560 SourceLocation ProtocolRAngleLoc,
9561 bool FailOnError = false);
9562
9563 /// Build an Objective-C object pointer type.
9565 SourceLocation Loc,
9566 SourceLocation TypeArgsLAngleLoc,
9568 SourceLocation TypeArgsRAngleLoc,
9569 SourceLocation ProtocolLAngleLoc,
9571 ArrayRef<SourceLocation> ProtocolLocs,
9572 SourceLocation ProtocolRAngleLoc,
9573 bool FailOnError = false);
9574
9575 /// Ensure attributes are consistent with type.
9576 /// \param [in, out] Attributes The attributes to check; they will
9577 /// be modified to be consistent with \p PropertyTy.
9578 void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
9579 SourceLocation Loc,
9580 unsigned &Attributes,
9581 bool propertyInPrimaryClass);
9582
9583 /// Process the specified property declaration and create decls for the
9584 /// setters and getters as needed.
9585 /// \param property The property declaration being processed
9586 void ProcessPropertyDecl(ObjCPropertyDecl *property);
9587
9588
9590 ObjCPropertyDecl *SuperProperty,
9591 const IdentifierInfo *Name,
9592 bool OverridingProtocolProperty);
9593
9595 ObjCInterfaceDecl *ID);
9596
9597 Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
9598 ArrayRef<Decl *> allMethods = None,
9599 ArrayRef<DeclGroupPtrTy> allTUVars = None);
9600
9602 SourceLocation LParenLoc,
9603 FieldDeclarator &FD, ObjCDeclSpec &ODS,
9604 Selector GetterSel, Selector SetterSel,
9605 tok::ObjCKeywordKind MethodImplKind,
9606 DeclContext *lexicalDC = nullptr);
9607
9609 SourceLocation AtLoc,
9610 SourceLocation PropertyLoc,
9611 bool ImplKind,
9612 IdentifierInfo *PropertyId,
9613 IdentifierInfo *PropertyIvar,
9614 SourceLocation PropertyIvarLoc,
9615 ObjCPropertyQueryKind QueryKind);
9616
9625
9629 // The Type is null if no type was specified, and the DeclSpec is invalid
9630 // in this case.
9633
9634 /// ArgAttrs - Attribute list for this argument.
9636 };
9637
9639 Scope *S,
9640 SourceLocation BeginLoc, // location of the + or -.
9641 SourceLocation EndLoc, // location of the ; or {.
9642 tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
9643 ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
9644 // optional arguments. The number of types/arguments is obtained
9645 // from the Sel.getNumArgs().
9646 ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
9647 unsigned CNumArgs, // c-style args
9648 const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind,
9649 bool isVariadic, bool MethodDefinition);
9650
9652 const ObjCObjectPointerType *OPT,
9653 bool IsInstance);
9655 bool IsInstance);
9656
9657 bool CheckARCMethodDecl(ObjCMethodDecl *method);
9659
9661
9664 Expr *BaseExpr,
9665 SourceLocation OpLoc,
9666 DeclarationName MemberName,
9667 SourceLocation MemberLoc,
9668 SourceLocation SuperLoc, QualType SuperType,
9669 bool Super);
9670
9673 IdentifierInfo &propertyName,
9674 SourceLocation receiverNameLoc,
9675 SourceLocation propertyNameLoc);
9676
9678
9679 /// Describes the kind of message expression indicated by a message
9680 /// send that starts with an identifier.
9682 /// The message is sent to 'super'.
9684 /// The message is an instance message.
9686 /// The message is a class message, and the identifier is a type
9687 /// name.
9690
9692 IdentifierInfo *Name,
9693 SourceLocation NameLoc,
9694 bool IsSuper,
9695 bool HasTrailingDot,
9696 ParsedType &ReceiverType);
9697
9699 Selector Sel,
9700 SourceLocation LBracLoc,
9701 ArrayRef<SourceLocation> SelectorLocs,
9702 SourceLocation RBracLoc,
9703 MultiExprArg Args);
9704
9706 QualType ReceiverType,
9707 SourceLocation SuperLoc,
9708 Selector Sel,
9709 ObjCMethodDecl *Method,
9710 SourceLocation LBracLoc,
9711 ArrayRef<SourceLocation> SelectorLocs,
9712 SourceLocation RBracLoc,
9713 MultiExprArg Args,
9714 bool isImplicit = false);
9715
9717 bool isSuperReceiver,
9718 SourceLocation Loc,
9719 Selector Sel,
9720 ObjCMethodDecl *Method,
9721 MultiExprArg Args);
9722
9724 ParsedType Receiver,
9725 Selector Sel,
9726 SourceLocation LBracLoc,
9727 ArrayRef<SourceLocation> SelectorLocs,
9728 SourceLocation RBracLoc,
9729 MultiExprArg Args);
9730
9732 QualType ReceiverType,
9733 SourceLocation SuperLoc,
9734 Selector Sel,
9735 ObjCMethodDecl *Method,
9736 SourceLocation LBracLoc,
9737 ArrayRef<SourceLocation> SelectorLocs,
9738 SourceLocation RBracLoc,
9739 MultiExprArg Args,
9740 bool isImplicit = false);
9741
9743 QualType ReceiverType,
9744 SourceLocation Loc,
9745 Selector Sel,
9746 ObjCMethodDecl *Method,
9747 MultiExprArg Args);
9748
9750 Expr *Receiver,
9751 Selector Sel,
9752 SourceLocation LBracLoc,
9753 ArrayRef<SourceLocation> SelectorLocs,
9754 SourceLocation RBracLoc,
9755 MultiExprArg Args);
9756
9758 ObjCBridgeCastKind Kind,
9759 SourceLocation BridgeKeywordLoc,
9760 TypeSourceInfo *TSInfo,
9761 Expr *SubExpr);
9762
9764 SourceLocation LParenLoc,
9765 ObjCBridgeCastKind Kind,
9766 SourceLocation BridgeKeywordLoc,
9768 SourceLocation RParenLoc,
9769 Expr *SubExpr);
9770
9772
9774
9776 CastKind &Kind);
9777
9779 QualType DestType, QualType SrcType,
9780 ObjCInterfaceDecl *&RelatedClass,
9781 ObjCMethodDecl *&ClassMethod,
9782 ObjCMethodDecl *&InstanceMethod,
9783 TypedefNameDecl *&TDNDecl,
9784 bool CfToNs, bool Diagnose = true);
9785
9787 QualType DestType, QualType SrcType,
9788 Expr *&SrcExpr, bool Diagnose = true);
9789
9790 bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr,
9791 bool Diagnose = true);
9792
9793 bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
9794
9795 /// Check whether the given new method is a valid override of the
9796 /// given overridden method, and set any properties that should be inherited.
9798 const ObjCMethodDecl *Overridden);
9799
9800 /// Describes the compatibility of a result type with its method.
9806
9808 ObjCMethodDecl *overridden);
9809
9811 ObjCInterfaceDecl *CurrentClass,
9813
9815 POAK_Native, // #pragma options align=native
9816 POAK_Natural, // #pragma options align=natural
9817 POAK_Packed, // #pragma options align=packed
9818 POAK_Power, // #pragma options align=power
9819 POAK_Mac68k, // #pragma options align=mac68k
9820 POAK_Reset // #pragma options align=reset
9822
9823 /// ActOnPragmaClangSection - Called on well formed \#pragma clang section
9826 PragmaClangSectionKind SecKind, StringRef SecName);
9827
9828 /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
9830 SourceLocation PragmaLoc);
9831
9832 /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
9833 void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action,
9834 StringRef SlotLabel, Expr *Alignment);
9835
9840
9842 SourceLocation IncludeLoc);
9844
9845 /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
9847
9848 /// ActOnPragmaMSComment - Called on well formed
9849 /// \#pragma comment(kind, "arg").
9851 StringRef Arg);
9852
9853 /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
9854 /// pointers_to_members(representation method[, general purpose
9855 /// representation]).
9858 SourceLocation PragmaLoc);
9859
9860 /// Called on well formed \#pragma vtordisp().
9862 SourceLocation PragmaLoc,
9864
9871
9872 bool UnifySection(StringRef SectionName, int SectionFlags,
9873 NamedDecl *TheDecl);
9874 bool UnifySection(StringRef SectionName,
9875 int SectionFlags,
9876 SourceLocation PragmaSectionLocation);
9877
9878 /// Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
9879 void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
9880 PragmaMsStackAction Action,
9881 llvm::StringRef StackSlotLabel,
9882 StringLiteral *SegmentName,
9883 llvm::StringRef PragmaName);
9884
9885 /// Called on well formed \#pragma section().
9886 void ActOnPragmaMSSection(SourceLocation PragmaLocation,
9887 int SectionFlags, StringLiteral *SegmentName);
9888
9889 /// Called on well-formed \#pragma init_seg().
9890 void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
9891 StringLiteral *SegmentName);
9892
9893 /// Called on #pragma clang __debug dump II
9895
9896 /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
9897 void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name,
9898 StringRef Value);
9899
9900 /// Are precise floating point semantics currently enabled?
9902 return !CurFPFeatures.getAllowFPReassociate() &&
9903 !CurFPFeatures.getNoSignedZero() &&
9904 !CurFPFeatures.getAllowReciprocal() &&
9905 !CurFPFeatures.getAllowApproxFunc();
9906 }
9907
9908 /// ActOnPragmaFloatControl - Call on well-formed \#pragma float_control
9911
9912 /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
9914 Scope *curScope,
9915 SourceLocation PragmaLoc);
9916
9917 /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
9918 void ActOnPragmaVisibility(const IdentifierInfo* VisType,
9919 SourceLocation PragmaLoc);
9920
9922 SourceLocation Loc);
9924
9925 /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
9926 void ActOnPragmaWeakID(IdentifierInfo* WeakName,
9927 SourceLocation PragmaLoc,
9928 SourceLocation WeakNameLoc);
9929
9930 /// ActOnPragmaRedefineExtname - Called on well formed
9931 /// \#pragma redefine_extname oldname newname.
9933 IdentifierInfo* AliasName,
9934 SourceLocation PragmaLoc,
9935 SourceLocation WeakNameLoc,
9936 SourceLocation AliasNameLoc);
9937
9938 /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
9939 void ActOnPragmaWeakAlias(IdentifierInfo* WeakName,
9940 IdentifierInfo* AliasName,
9941 SourceLocation PragmaLoc,
9942 SourceLocation WeakNameLoc,
9943 SourceLocation AliasNameLoc);
9944
9945 /// ActOnPragmaFPContract - Called on well formed
9946 /// \#pragma {STDC,OPENCL} FP_CONTRACT and
9947 /// \#pragma clang fp contract
9949
9950 /// Called on well formed
9951 /// \#pragma clang fp reassociate
9952 void ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled);
9953
9954 /// ActOnPragmaFenvAccess - Called on well formed
9955 /// \#pragma STDC FENV_ACCESS
9956 void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled);
9957
9958 /// Called on well formed '\#pragma clang fp' that has option 'exceptions'.
9961
9962 /// Called to set constant rounding mode for floating point operations.
9963 void setRoundingMode(SourceLocation Loc, llvm::RoundingMode);
9964
9965 /// Called to set exception behavior for floating point operations.
9967
9968 /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
9969 /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
9971
9972 /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
9974
9975 /// PushNamespaceVisibilityAttr - Note that we've entered a
9976 /// namespace with a visibility attribute.
9978 SourceLocation Loc);
9979
9980 /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
9981 /// add an appropriate visibility attribute.
9983
9984 /// PopPragmaVisibility - Pop the top element of the visibility stack; used
9985 /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
9986 void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc);
9987
9988 /// FreeVisContext - Deallocate and null out VisContext.
9989 void FreeVisContext();
9990
9991 /// AddCFAuditedAttribute - Check whether we're currently within
9992 /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
9993 /// the appropriate attribute.
9994 void AddCFAuditedAttribute(Decl *D);
9995
9997 SourceLocation PragmaLoc,
10000 const IdentifierInfo *Namespace);
10001
10002 /// Called on well-formed '\#pragma clang attribute pop'.
10004 const IdentifierInfo *Namespace);
10005
10006 /// Adds the attributes that have been specified using the
10007 /// '\#pragma clang attribute push' directives to the given declaration.
10008 void AddPragmaAttributes(Scope *S, Decl *D);
10009
10011
10012 /// Called on well formed \#pragma clang optimize.
10013 void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc);
10014
10015 /// Get the location for the currently active "\#pragma clang optimize
10016 /// off". If this location is invalid, then the state of the pragma is "on".
10020
10021 /// Only called on function definitions; if there is a pragma in scope
10022 /// with the effect of a range-based optnone, consider marking the function
10023 /// with attribute optnone.
10025
10026 /// Adds the 'optnone' attribute to the function declaration if there
10027 /// are no conflicts; Loc represents the location causing the 'optnone'
10028 /// attribute to be added (usually because of a pragma).
10030
10031 /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
10033 bool IsPackExpansion);
10035 bool IsPackExpansion);
10036
10037 /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
10038 /// declaration.
10040 Expr *OE);
10041
10042 /// AddAllocAlignAttr - Adds an alloc_align attribute to a particular
10043 /// declaration.
10045 Expr *ParamExpr);
10046
10047 /// AddAlignValueAttr - Adds an align_value attribute to a particular
10048 /// declaration.
10050
10051 /// AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
10053 StringRef Annot, MutableArrayRef<Expr *> Args);
10054
10055 /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
10056 /// declaration.
10058 Expr *MaxThreads, Expr *MinBlocks);
10059
10060 /// AddModeAttr - Adds a mode attribute to a particular declaration.
10062 bool InInstantiation = false);
10063
10065 ParameterABI ABI);
10066
10067 enum class RetainOwnershipKind {NS, CF, OS};
10069 RetainOwnershipKind K, bool IsTemplateInstantiation);
10070
10071 /// addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size
10072 /// attribute to a particular declaration.
10074 Expr *Min, Expr *Max);
10075
10076 /// addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a
10077 /// particular declaration.
10079 Expr *Min, Expr *Max);
10080
10082
10083 //===--------------------------------------------------------------------===//
10084 // C++ Coroutines TS
10085 //
10087 StringRef Keyword);
10091
10093 bool IsImplicit = false);
10095 UnresolvedLookupExpr* Lookup);
10098 bool IsImplicit = false);
10104 SourceLocation FuncLoc);
10105 /// Check that the expression co_await promise.final_suspend() shall not be
10106 /// potentially-throwing.
10107 bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend);
10108
10109 //===--------------------------------------------------------------------===//
10110 // OpenCL extensions.
10111 //
10112private:
10113 std::string CurrOpenCLExtension;
10114 /// Extensions required by an OpenCL type.
10115 llvm::DenseMap<const Type*, std::set<std::string>> OpenCLTypeExtMap;
10116 /// Extensions required by an OpenCL declaration.
10117 llvm::DenseMap<const Decl*, std::set<std::string>> OpenCLDeclExtMap;
10118public:
10119 llvm::StringRef getCurrentOpenCLExtension() const {
10120 return CurrOpenCLExtension;
10121 }
10122
10123 /// Check if a function declaration \p FD associates with any
10124 /// extensions present in OpenCLDeclExtMap and if so return the
10125 /// extension(s) name(s).
10127
10128 /// Check if a function type \p FT associates with any
10129 /// extensions present in OpenCLTypeExtMap and if so return the
10130 /// extension(s) name(s).
10132
10133 /// Find an extension in an appropriate extension map and return its name
10134 template<typename T, typename MapT>
10135 std::string getOpenCLExtensionsFromExtMap(T* FT, MapT &Map);
10136
10137 void setCurrentOpenCLExtension(llvm::StringRef Ext) {
10138 CurrOpenCLExtension = std::string(Ext);
10139 }
10140
10141 /// Set OpenCL extensions for a type which can only be used when these
10142 /// OpenCL extensions are enabled. If \p Exts is empty, do nothing.
10143 /// \param Exts A space separated list of OpenCL extensions.
10144 void setOpenCLExtensionForType(QualType T, llvm::StringRef Exts);
10145
10146 /// Set OpenCL extensions for a declaration which can only be
10147 /// used when these OpenCL extensions are enabled. If \p Exts is empty, do
10148 /// nothing.
10149 /// \param Exts A space separated list of OpenCL extensions.
10150 void setOpenCLExtensionForDecl(Decl *FD, llvm::StringRef Exts);
10151
10152 /// Set current OpenCL extensions for a type which can only be used
10153 /// when these OpenCL extensions are enabled. If current OpenCL extension is
10154 /// empty, do nothing.
10156
10157 /// Set current OpenCL extensions for a declaration which
10158 /// can only be used when these OpenCL extensions are enabled. If current
10159 /// OpenCL extension is empty, do nothing.
10161
10162 bool isOpenCLDisabledDecl(Decl *FD);
10163
10164 /// Check if type \p T corresponding to declaration specifier \p DS
10165 /// is disabled due to required OpenCL extensions being disabled. If so,
10166 /// emit diagnostics.
10167 /// \return true if type is disabled.
10169
10170 /// Check if declaration \p D used by expression \p E
10171 /// is disabled due to required OpenCL extensions being disabled. If so,
10172 /// emit diagnostics.
10173 /// \return true if type is disabled.
10174 bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
10175
10176 //===--------------------------------------------------------------------===//
10177 // OpenMP directives and clauses.
10178 //
10179private:
10180 void *VarDataSharingAttributesStack;
10181 /// Number of nested '#pragma omp declare target' directives.
10182 SmallVector<SourceLocation, 4> DeclareTargetNesting;
10183 /// Initialization of data-sharing attributes stack.
10184 void InitDataSharingAttributesStack();
10185 void DestroyDataSharingAttributesStack();
10187 VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind,
10188 bool StrictlyPositive = true);
10189 /// Returns OpenMP nesting level for current directive.
10190 unsigned getOpenMPNestingLevel() const;
10191
10192 /// Adjusts the function scopes index for the target-based regions.
10193 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
10194 unsigned Level) const;
10195
10196 /// Returns the number of scopes associated with the construct on the given
10197 /// OpenMP level.
10198 int getNumberOfConstructScopes(unsigned Level) const;
10199
10200 /// Push new OpenMP function region for non-capturing function.
10201 void pushOpenMPFunctionRegion();
10202
10203 /// Pop OpenMP function region for non-capturing function.
10204 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
10205
10206 /// Checks if a type or a declaration is disabled due to the owning extension
10207 /// being disabled, and emits diagnostic messages if it is disabled.
10208 /// \param D type or declaration to be checked.
10209 /// \param DiagLoc source location for the diagnostic message.
10210 /// \param DiagInfo information to be emitted for the diagnostic message.
10211 /// \param SrcRange source range of the declaration.
10212 /// \param Map maps type or declaration to the extensions.
10213 /// \param Selector selects diagnostic message: 0 for type and 1 for
10214 /// declaration.
10215 /// \return true if the type or declaration is disabled.
10216 template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT>
10217 bool checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc, DiagInfoT DiagInfo,
10218 MapT &Map, unsigned Selector = 0,
10219 SourceRange SrcRange = SourceRange());
10220
10221 /// Helper to keep information about the current `omp begin/end declare
10222 /// variant` nesting.
10223 struct OMPDeclareVariantScope {
10224 /// The associated OpenMP context selector.
10225 OMPTraitInfo *TI;
10226
10227 /// The associated OpenMP context selector mangling.
10228 std::string NameSuffix;
10229
10230 OMPDeclareVariantScope(OMPTraitInfo &TI);
10231 };
10232
10233 /// Return the OMPTraitInfo for the surrounding scope, if any.
10234 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
10235 return OMPDeclareVariantScopes.empty() ? nullptr
10236 : OMPDeclareVariantScopes.back().TI;
10237 }
10238
10239 /// The current `omp begin/end declare variant` scopes.
10240 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
10241
10242 /// The current `omp begin/end assumes` scopes.
10243 SmallVector<AssumptionAttr *, 4> OMPAssumeScoped;
10244
10245 /// All `omp assumes` we encountered so far.
10246 SmallVector<AssumptionAttr *, 4> OMPAssumeGlobal;
10247
10248public:
10249 /// The declarator \p D defines a function in the scope \p S which is nested
10250 /// in an `omp begin/end declare variant` scope. In this method we create a
10251 /// declaration for \p D and rename \p D according to the OpenMP context
10252 /// selector of the surrounding scope. Return all base functions in \p Bases.
10254 Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists,
10255 SmallVectorImpl<FunctionDecl *> &Bases);
10256
10257 /// Register \p D as specialization of all base functions in \p Bases in the
10258 /// current `omp begin/end declare variant` scope.
10260 Decl *D, SmallVectorImpl<FunctionDecl *> &Bases);
10261
10262 /// Act on \p D, a function definition inside of an `omp [begin/end] assumes`.
10264
10265 /// Can we exit an OpenMP declare variant scope at the moment.
10267 return !OMPDeclareVariantScopes.empty();
10268 }
10269
10270 /// Given the potential call expression \p Call, determine if there is a
10271 /// specialization via the OpenMP declare variant mechanism available. If
10272 /// there is, return the specialized call expression, otherwise return the
10273 /// original \p Call.
10275 SourceLocation LParenLoc, MultiExprArg ArgExprs,
10276 SourceLocation RParenLoc, Expr *ExecConfig);
10277
10278 /// Handle a `omp begin declare variant`.
10280
10281 /// Handle a `omp end declare variant`.
10283
10284 /// Checks if the variant/multiversion functions are compatible.
10286 const FunctionDecl *OldFD, const FunctionDecl *NewFD,
10287 const PartialDiagnostic &NoProtoDiagID,
10288 const PartialDiagnosticAt &NoteCausedDiagIDAt,
10289 const PartialDiagnosticAt &NoSupportDiagIDAt,
10290 const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported,
10291 bool ConstexprSupported, bool CLinkageMayDiffer);
10292
10293 /// Function tries to capture lambda's captured variables in the OpenMP region
10294 /// before the original lambda is captured.
10296
10297 /// Return true if the provided declaration \a VD should be captured by
10298 /// reference.
10299 /// \param Level Relative level of nested OpenMP construct for that the check
10300 /// is performed.
10301 /// \param OpenMPCaptureLevel Capture level within an OpenMP construct.
10302 bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
10303 unsigned OpenMPCaptureLevel) const;
10304
10305 /// Check if the specified variable is used in one of the private
10306 /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
10307 /// constructs.
10308 VarDecl *isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo = false,
10309 unsigned StopAt = 0);
10312
10313 /// If the current region is a loop-based region, mark the start of the loop
10314 /// construct.
10315 void startOpenMPLoop();
10316
10317 /// If the current region is a range loop-based region, mark the start of the
10318 /// loop construct.
10320
10321 /// Check if the specified variable is used in 'private' clause.
10322 /// \param Level Relative level of nested OpenMP construct for that the check
10323 /// is performed.
10325 unsigned CapLevel) const;
10326
10327 /// Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.)
10328 /// for \p FD based on DSA for the provided corresponding captured declaration
10329 /// \p D.
10330 void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level);
10331
10332 /// Check if the specified variable is captured by 'target' directive.
10333 /// \param Level Relative level of nested OpenMP construct for that the check
10334 /// is performed.
10335 bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level,
10336 unsigned CaptureLevel) const;
10337
10338 /// Check if the specified global variable must be captured by outer capture
10339 /// regions.
10340 /// \param Level Relative level of nested OpenMP construct for that
10341 /// the check is performed.
10342 bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
10343 unsigned CaptureLevel) const;
10344
10346 Expr *Op);
10347 /// Called on start of new data sharing attribute block.
10349 const DeclarationNameInfo &DirName, Scope *CurScope,
10350 SourceLocation Loc);
10351 /// Start analysis of clauses.
10353 /// End analysis of clauses.
10354 void EndOpenMPClause();
10355 /// Called on end of data sharing attribute block.
10356 void EndOpenMPDSABlock(Stmt *CurDirective);
10357
10358 /// Check if the current region is an OpenMP loop region and if it is,
10359 /// mark loop control variable, used in \p Init for loop initialization, as
10360 /// private by default.
10361 /// \param Init First part of the for loop.
10363
10364 // OpenMP directives and clauses.
10365 /// Called on correct id-expression from the '#pragma omp
10366 /// threadprivate'.
10368 const DeclarationNameInfo &Id,
10369 OpenMPDirectiveKind Kind);
10370 /// Called on well-formed '#pragma omp threadprivate'.
10372 SourceLocation Loc,
10373 ArrayRef<Expr *> VarList);
10374 /// Builds a new OpenMPThreadPrivateDecl and checks its correctness.
10376 ArrayRef<Expr *> VarList);
10377 /// Called on well-formed '#pragma omp allocate'.
10379 ArrayRef<Expr *> VarList,
10380 ArrayRef<OMPClause *> Clauses,
10381 DeclContext *Owner = nullptr);
10382
10383 /// Called on well-formed '#pragma omp [begin] assume[s]'.
10385 OpenMPDirectiveKind DKind,
10386 ArrayRef<StringRef> Assumptions,
10387 bool SkippedClauses);
10388
10389 /// Check if there is an active global `omp begin assumes` directive.
10390 bool isInOpenMPAssumeScope() const { return !OMPAssumeScoped.empty(); }
10391
10392 /// Check if there is an active global `omp assumes` directive.
10393 bool hasGlobalOpenMPAssumes() const { return !OMPAssumeGlobal.empty(); }
10394
10395 /// Called on well-formed '#pragma omp end assumes'.
10397
10398 /// Called on well-formed '#pragma omp requires'.
10400 ArrayRef<OMPClause *> ClauseList);
10401 /// Check restrictions on Requires directive
10403 ArrayRef<OMPClause *> Clauses);
10404 /// Check if the specified type is allowed to be used in 'omp declare
10405 /// reduction' construct.
10408 /// Called on start of '#pragma omp declare reduction'.
10410 Scope *S, DeclContext *DC, DeclarationName Name,
10411 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
10412 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
10413 /// Initialize declare reduction construct initializer.
10415 /// Finish current declare reduction construct initializer.
10417 /// Initialize declare reduction construct initializer.
10418 /// \return omp_priv variable.
10420 /// Finish current declare reduction construct initializer.
10422 VarDecl *OmpPrivParm);
10423 /// Called at the end of '#pragma omp declare reduction'.
10425 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
10426
10427 /// Check variable declaration in 'omp declare mapper' construct.
10429 /// Check if the specified type is allowed to be used in 'omp declare
10430 /// mapper' construct.
10433 /// Called on start of '#pragma omp declare mapper'.
10435 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
10437 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
10438 Decl *PrevDeclInScope = nullptr);
10439 /// Build the mapper variable of '#pragma omp declare mapper'.
10441 QualType MapperType,
10442 SourceLocation StartLoc,
10443 DeclarationName VN);
10444 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
10446
10447 /// Called on the start of target region i.e. '#pragma omp declare target'.
10449 /// Called at the end of target region i.e. '#pragme omp end declare target'.
10451 /// Searches for the provided declaration name for OpenMP declare target
10452 /// directive.
10453 NamedDecl *
10454 lookupOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec,
10455 const DeclarationNameInfo &Id,
10456 NamedDeclSetType &SameDirectiveDecls);
10457 /// Called on correct id-expression from the '#pragma omp declare target'.
10461 /// Check declaration inside target region.
10462 void
10464 SourceLocation IdLoc = SourceLocation());
10465 /// Finishes analysis of the deferred functions calls that may be declared as
10466 /// host/nohost during device/host compilation.
10468 const FunctionDecl *Callee,
10469 SourceLocation Loc);
10470 /// Return true inside OpenMP declare target region.
10472 return !DeclareTargetNesting.empty();
10473 }
10474 /// Return true inside OpenMP target region.
10476
10477 /// Return the number of captured regions created for an OpenMP directive.
10479
10480 /// Initialization of captured region for OpenMP region.
10481 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
10482 /// End of OpenMP region.
10483 ///
10484 /// \param S Statement associated with the current OpenMP region.
10485 /// \param Clauses List of clauses for the current OpenMP region.
10486 ///
10487 /// \returns Statement for finished OpenMP region.
10490 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
10491 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
10492 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
10493 /// Called on well-formed '\#pragma omp parallel' after parsing
10494 /// of the associated statement.
10496 Stmt *AStmt,
10497 SourceLocation StartLoc,
10498 SourceLocation EndLoc);
10500 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
10501 /// Called on well-formed '\#pragma omp simd' after parsing
10502 /// of the associated statement.
10505 SourceLocation StartLoc, SourceLocation EndLoc,
10506 VarsWithInheritedDSAType &VarsWithImplicitDSA);
10507 /// Called on well-formed '\#pragma omp for' after parsing
10508 /// of the associated statement.
10511 SourceLocation StartLoc, SourceLocation EndLoc,
10512 VarsWithInheritedDSAType &VarsWithImplicitDSA);
10513 /// Called on well-formed '\#pragma omp for simd' after parsing
10514 /// of the associated statement.
10517 SourceLocation StartLoc, SourceLocation EndLoc,
10518 VarsWithInheritedDSAType &VarsWithImplicitDSA);
10519 /// Called on well-formed '\#pragma omp sections' after parsing
10520 /// of the associated statement.
10522 Stmt *AStmt, SourceLocation StartLoc,
10523 SourceLocation EndLoc);
10524 /// Called on well-formed '\#pragma omp section' after parsing of the
10525 /// associated statement.
10527 SourceLocation EndLoc);
10528 /// Called on well-formed '\#pragma omp single' after parsing of the
10529 /// associated statement.
10531 Stmt *AStmt, SourceLocation StartLoc,
10532 SourceLocation EndLoc);
10533 /// Called on well-formed '\#pragma omp master' after parsing of the
10534 /// associated statement.
10536 SourceLocation EndLoc);
10537 /// Called on well-formed '\#pragma omp critical' after parsing of the
10538 /// associated statement.
10540 ArrayRef<OMPClause *> Clauses,
10541 Stmt *AStmt, SourceLocation StartLoc,
10542 SourceLocation EndLoc);
10543 /// Called on well-formed '\#pragma omp parallel for' after parsing
10544 /// of the associated statement.
10546 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10547 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10548 /// Called on well-formed '\#pragma omp parallel for simd' after
10549 /// parsing of the associated statement.
10551 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10552 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10553 /// Called on well-formed '\#pragma omp parallel master' after
10554 /// parsing of the associated statement.
10556 Stmt *AStmt,
10557 SourceLocation StartLoc,
10558 SourceLocation EndLoc);
10559 /// Called on well-formed '\#pragma omp parallel sections' after
10560 /// parsing of the associated statement.
10562 Stmt *AStmt,
10563 SourceLocation StartLoc,
10564 SourceLocation EndLoc);
10565 /// Called on well-formed '\#pragma omp task' after parsing of the
10566 /// associated statement.
10568 Stmt *AStmt, SourceLocation StartLoc,
10569 SourceLocation EndLoc);
10570 /// Called on well-formed '\#pragma omp taskyield'.
10572 SourceLocation EndLoc);
10573 /// Called on well-formed '\#pragma omp barrier'.
10575 SourceLocation EndLoc);
10576 /// Called on well-formed '\#pragma omp taskwait'.
10578 SourceLocation EndLoc);
10579 /// Called on well-formed '\#pragma omp taskgroup'.
10581 Stmt *AStmt, SourceLocation StartLoc,
10582 SourceLocation EndLoc);
10583 /// Called on well-formed '\#pragma omp flush'.
10585 SourceLocation StartLoc,
10586 SourceLocation EndLoc);
10587 /// Called on well-formed '\#pragma omp depobj'.
10589 SourceLocation StartLoc,
10590 SourceLocation EndLoc);
10591 /// Called on well-formed '\#pragma omp scan'.
10593 SourceLocation StartLoc,
10594 SourceLocation EndLoc);
10595 /// Called on well-formed '\#pragma omp ordered' after parsing of the
10596 /// associated statement.
10598 Stmt *AStmt, SourceLocation StartLoc,
10599 SourceLocation EndLoc);
10600 /// Called on well-formed '\#pragma omp atomic' after parsing of the
10601 /// associated statement.
10603 Stmt *AStmt, SourceLocation StartLoc,
10604 SourceLocation EndLoc);
10605 /// Called on well-formed '\#pragma omp target' after parsing of the
10606 /// associated statement.
10608 Stmt *AStmt, SourceLocation StartLoc,
10609 SourceLocation EndLoc);
10610 /// Called on well-formed '\#pragma omp target data' after parsing of
10611 /// the associated statement.
10613 Stmt *AStmt, SourceLocation StartLoc,
10614 SourceLocation EndLoc);
10615 /// Called on well-formed '\#pragma omp target enter data' after
10616 /// parsing of the associated statement.
10618 SourceLocation StartLoc,
10619 SourceLocation EndLoc,
10620 Stmt *AStmt);
10621 /// Called on well-formed '\#pragma omp target exit data' after
10622 /// parsing of the associated statement.
10624 SourceLocation StartLoc,
10625 SourceLocation EndLoc,
10626 Stmt *AStmt);
10627 /// Called on well-formed '\#pragma omp target parallel' after
10628 /// parsing of the associated statement.
10630 Stmt *AStmt,
10631 SourceLocation StartLoc,
10632 SourceLocation EndLoc);
10633 /// Called on well-formed '\#pragma omp target parallel for' after
10634 /// parsing of the associated statement.
10636 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10637 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10638 /// Called on well-formed '\#pragma omp teams' after parsing of the
10639 /// associated statement.
10641 Stmt *AStmt, SourceLocation StartLoc,
10642 SourceLocation EndLoc);
10643 /// Called on well-formed '\#pragma omp cancellation point'.
10646 SourceLocation EndLoc,
10647 OpenMPDirectiveKind CancelRegion);
10648 /// Called on well-formed '\#pragma omp cancel'.
10650 SourceLocation StartLoc,
10651 SourceLocation EndLoc,
10652 OpenMPDirectiveKind CancelRegion);
10653 /// Called on well-formed '\#pragma omp taskloop' after parsing of the
10654 /// associated statement.
10657 SourceLocation StartLoc, SourceLocation EndLoc,
10658 VarsWithInheritedDSAType &VarsWithImplicitDSA);
10659 /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
10660 /// the associated statement.
10662 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10663 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10664 /// Called on well-formed '\#pragma omp master taskloop' after parsing of the
10665 /// associated statement.
10667 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10668 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10669 /// Called on well-formed '\#pragma omp master taskloop simd' after parsing of
10670 /// the associated statement.
10672 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10673 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10674 /// Called on well-formed '\#pragma omp parallel master taskloop' after
10675 /// parsing of the associated statement.
10677 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10678 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10679 /// Called on well-formed '\#pragma omp parallel master taskloop simd' after
10680 /// parsing of the associated statement.
10682 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10683 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10684 /// Called on well-formed '\#pragma omp distribute' after parsing
10685 /// of the associated statement.
10688 SourceLocation StartLoc, SourceLocation EndLoc,
10689 VarsWithInheritedDSAType &VarsWithImplicitDSA);
10690 /// Called on well-formed '\#pragma omp target update'.
10692 SourceLocation StartLoc,
10693 SourceLocation EndLoc,
10694 Stmt *AStmt);
10695 /// Called on well-formed '\#pragma omp distribute parallel for' after
10696 /// parsing of the associated statement.
10698 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10699 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10700 /// Called on well-formed '\#pragma omp distribute parallel for simd'
10701 /// after parsing of the associated statement.
10703 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10704 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10705 /// Called on well-formed '\#pragma omp distribute simd' after
10706 /// parsing of the associated statement.
10708 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10709 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10710 /// Called on well-formed '\#pragma omp target parallel for simd' after
10711 /// parsing of the associated statement.
10713 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10714 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10715 /// Called on well-formed '\#pragma omp target simd' after parsing of
10716 /// the associated statement.
10719 SourceLocation StartLoc, SourceLocation EndLoc,
10720 VarsWithInheritedDSAType &VarsWithImplicitDSA);
10721 /// Called on well-formed '\#pragma omp teams distribute' after parsing of
10722 /// the associated statement.
10724 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10725 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10726 /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
10727 /// of the associated statement.
10729 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10730 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10731 /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
10732 /// after parsing of the associated statement.
10734 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10735 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10736 /// Called on well-formed '\#pragma omp teams distribute parallel for'
10737 /// after parsing of the associated statement.
10739 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10740 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10741 /// Called on well-formed '\#pragma omp target teams' after parsing of the
10742 /// associated statement.
10744 Stmt *AStmt,
10745 SourceLocation StartLoc,
10746 SourceLocation EndLoc);
10747 /// Called on well-formed '\#pragma omp target teams distribute' after parsing
10748 /// of the associated statement.
10750 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10751 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10752 /// Called on well-formed '\#pragma omp target teams distribute parallel for'
10753 /// after parsing of the associated statement.
10755 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10756 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10757 /// Called on well-formed '\#pragma omp target teams distribute parallel for
10758 /// simd' after parsing of the associated statement.
10760 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10761 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10762 /// Called on well-formed '\#pragma omp target teams distribute simd' after
10763 /// parsing of the associated statement.
10765 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
10766 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
10767
10768 /// Checks correctness of linear modifiers.
10770 SourceLocation LinLoc);
10771 /// Checks that the specified declaration matches requirements for the linear
10772 /// decls.
10775 bool IsDeclareSimd = false);
10776
10777 /// Called on well-formed '\#pragma omp declare simd' after parsing of
10778 /// the associated method/function.
10781 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
10782 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
10783 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
10784
10785 /// Checks '\#pragma omp declare variant' variant function and original
10786 /// functions after parsing of the associated method/function.
10787 /// \param DG Function declaration to which declare variant directive is
10788 /// applied to.
10789 /// \param VariantRef Expression that references the variant function, which
10790 /// must be used instead of the original one, specified in \p DG.
10791 /// \param TI The trait info object representing the match clause.
10792 /// \returns None, if the function/variant function are not compatible with
10793 /// the pragma, pair of original function/variant ref expression otherwise.
10796 OMPTraitInfo &TI, SourceRange SR);
10797
10798 /// Called on well-formed '\#pragma omp declare variant' after parsing of
10799 /// the associated method/function.
10800 /// \param FD Function declaration to which declare variant directive is
10801 /// applied to.
10802 /// \param VariantRef Expression that references the variant function, which
10803 /// must be used instead of the original one, specified in \p DG.
10804 /// \param TI The context traits associated with the function variant.
10806 OMPTraitInfo &TI, SourceRange SR);
10807
10809 Expr *Expr,
10810 SourceLocation StartLoc,
10811 SourceLocation LParenLoc,
10812 SourceLocation EndLoc);
10813 /// Called on well-formed 'allocator' clause.
10815 SourceLocation StartLoc,
10816 SourceLocation LParenLoc,
10817 SourceLocation EndLoc);
10818 /// Called on well-formed 'if' clause.
10820 Expr *Condition, SourceLocation StartLoc,
10821 SourceLocation LParenLoc,
10822 SourceLocation NameModifierLoc,
10823 SourceLocation ColonLoc,
10824 SourceLocation EndLoc);
10825 /// Called on well-formed 'final' clause.
10827 SourceLocation LParenLoc,
10828 SourceLocation EndLoc);
10829 /// Called on well-formed 'num_threads' clause.
10831 SourceLocation StartLoc,
10832 SourceLocation LParenLoc,
10833 SourceLocation EndLoc);
10834 /// Called on well-formed 'safelen' clause.
10836 SourceLocation StartLoc,
10837 SourceLocation LParenLoc,
10838 SourceLocation EndLoc);
10839 /// Called on well-formed 'simdlen' clause.
10841 SourceLocation LParenLoc,
10842 SourceLocation EndLoc);
10843 /// Called on well-formed 'collapse' clause.
10845 SourceLocation StartLoc,
10846 SourceLocation LParenLoc,
10847 SourceLocation EndLoc);
10848 /// Called on well-formed 'ordered' clause.
10849 OMPClause *
10851 SourceLocation LParenLoc = SourceLocation(),
10852 Expr *NumForLoops = nullptr);
10853 /// Called on well-formed 'grainsize' clause.
10855 SourceLocation LParenLoc,
10856 SourceLocation EndLoc);
10857 /// Called on well-formed 'num_tasks' clause.
10859 SourceLocation LParenLoc,
10860 SourceLocation EndLoc);
10861 /// Called on well-formed 'hint' clause.
10863 SourceLocation LParenLoc,
10864 SourceLocation EndLoc);
10865 /// Called on well-formed 'detach' clause.
10867 SourceLocation LParenLoc,
10868 SourceLocation EndLoc);
10869
10871 unsigned Argument,
10872 SourceLocation ArgumentLoc,
10873 SourceLocation StartLoc,
10874 SourceLocation LParenLoc,
10875 SourceLocation EndLoc);
10876 /// Called on well-formed 'default' clause.
10877 OMPClause *ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind,
10878 SourceLocation KindLoc,
10879 SourceLocation StartLoc,
10880 SourceLocation LParenLoc,
10881 SourceLocation EndLoc);
10882 /// Called on well-formed 'proc_bind' clause.
10883 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
10884 SourceLocation KindLoc,
10885 SourceLocation StartLoc,
10886 SourceLocation LParenLoc,
10887 SourceLocation EndLoc);
10888 /// Called on well-formed 'order' clause.
10890 SourceLocation KindLoc,
10891 SourceLocation StartLoc,
10892 SourceLocation LParenLoc,
10893 SourceLocation EndLoc);
10894 /// Called on well-formed 'update' clause.
10896 SourceLocation KindLoc,
10897 SourceLocation StartLoc,
10898 SourceLocation LParenLoc,
10899 SourceLocation EndLoc);
10900
10902 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
10903 SourceLocation StartLoc, SourceLocation LParenLoc,
10904 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
10905 SourceLocation EndLoc);
10906 /// Called on well-formed 'schedule' clause.
10909 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
10910 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
10911 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
10912
10914 SourceLocation EndLoc);
10915 /// Called on well-formed 'nowait' clause.
10917 SourceLocation EndLoc);
10918 /// Called on well-formed 'untied' clause.
10920 SourceLocation EndLoc);
10921 /// Called on well-formed 'mergeable' clause.
10923 SourceLocation EndLoc);
10924 /// Called on well-formed 'read' clause.
10926 SourceLocation EndLoc);
10927 /// Called on well-formed 'write' clause.
10929 SourceLocation EndLoc);
10930 /// Called on well-formed 'update' clause.
10932 SourceLocation EndLoc);
10933 /// Called on well-formed 'capture' clause.
10935 SourceLocation EndLoc);
10936 /// Called on well-formed 'seq_cst' clause.
10938 SourceLocation EndLoc);
10939 /// Called on well-formed 'acq_rel' clause.
10941 SourceLocation EndLoc);
10942 /// Called on well-formed 'acquire' clause.
10944 SourceLocation EndLoc);
10945 /// Called on well-formed 'release' clause.
10947 SourceLocation EndLoc);
10948 /// Called on well-formed 'relaxed' clause.
10950 SourceLocation EndLoc);
10951 /// Called on well-formed 'destroy' clause.
10953 SourceLocation EndLoc);
10954 /// Called on well-formed 'threads' clause.
10956 SourceLocation EndLoc);
10957 /// Called on well-formed 'simd' clause.
10959 SourceLocation EndLoc);
10960 /// Called on well-formed 'nogroup' clause.
10962 SourceLocation EndLoc);
10963 /// Called on well-formed 'unified_address' clause.
10965 SourceLocation EndLoc);
10966
10967 /// Called on well-formed 'unified_address' clause.
10969 SourceLocation EndLoc);
10970
10971 /// Called on well-formed 'reverse_offload' clause.
10973 SourceLocation EndLoc);
10974
10975 /// Called on well-formed 'dynamic_allocators' clause.
10977 SourceLocation EndLoc);
10978
10979 /// Called on well-formed 'atomic_default_mem_order' clause.
10982 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
10983
10985 OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *DepModOrTailExpr,
10986 const OMPVarListLocTy &Locs, SourceLocation ColonLoc,
10987 CXXScopeSpec &ReductionOrMapperIdScopeSpec,
10988 DeclarationNameInfo &ReductionOrMapperId, int ExtraModifier,
10989 ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
10990 ArrayRef<SourceLocation> MapTypeModifiersLoc, bool IsMapTypeImplicit,
10991 SourceLocation ExtraModifierLoc,
10992 ArrayRef<OpenMPMotionModifierKind> MotionModifiers,
10993 ArrayRef<SourceLocation> MotionModifiersLoc);
10994 /// Called on well-formed 'inclusive' clause.
10996 SourceLocation StartLoc,
10997 SourceLocation LParenLoc,
10998 SourceLocation EndLoc);
10999 /// Called on well-formed 'exclusive' clause.
11001 SourceLocation StartLoc,
11002 SourceLocation LParenLoc,
11003 SourceLocation EndLoc);
11004 /// Called on well-formed 'allocate' clause.
11005 OMPClause *
11007 SourceLocation StartLoc, SourceLocation ColonLoc,
11008 SourceLocation LParenLoc, SourceLocation EndLoc);
11009 /// Called on well-formed 'private' clause.
11011 SourceLocation StartLoc,
11012 SourceLocation LParenLoc,
11013 SourceLocation EndLoc);
11014 /// Called on well-formed 'firstprivate' clause.
11016 SourceLocation StartLoc,
11017 SourceLocation LParenLoc,
11018 SourceLocation EndLoc);
11019 /// Called on well-formed 'lastprivate' clause.
11022 SourceLocation LPKindLoc, SourceLocation ColonLoc,
11023 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
11024 /// Called on well-formed 'shared' clause.
11026 SourceLocation StartLoc,
11027 SourceLocation LParenLoc,
11028 SourceLocation EndLoc);
11029 /// Called on well-formed 'reduction' clause.
11032 SourceLocation StartLoc, SourceLocation LParenLoc,
11033 SourceLocation ModifierLoc, SourceLocation ColonLoc,
11034 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
11035 const DeclarationNameInfo &ReductionId,
11036 ArrayRef<Expr *> UnresolvedReductions = llvm::None);
11037 /// Called on well-formed 'task_reduction' clause.
11039 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
11040 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
11041 CXXScopeSpec &ReductionIdScopeSpec,
11042 const DeclarationNameInfo &ReductionId,
11043 ArrayRef<Expr *> UnresolvedReductions = llvm::None);
11044 /// Called on well-formed 'in_reduction' clause.
11046 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
11047 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
11048 CXXScopeSpec &ReductionIdScopeSpec,
11049 const DeclarationNameInfo &ReductionId,
11050 ArrayRef<Expr *> UnresolvedReductions = llvm::None);
11051 /// Called on well-formed 'linear' clause.
11052 OMPClause *
11054 SourceLocation StartLoc, SourceLocation LParenLoc,
11055 OpenMPLinearClauseKind LinKind, SourceLocation LinLoc,
11056 SourceLocation ColonLoc, SourceLocation EndLoc);
11057 /// Called on well-formed 'aligned' clause.
11059 Expr *Alignment,
11060 SourceLocation StartLoc,
11061 SourceLocation LParenLoc,
11062 SourceLocation ColonLoc,
11063 SourceLocation EndLoc);
11064 /// Called on well-formed 'copyin' clause.
11066 SourceLocation StartLoc,
11067 SourceLocation LParenLoc,
11068 SourceLocation EndLoc);
11069 /// Called on well-formed 'copyprivate' clause.
11071 SourceLocation StartLoc,
11072 SourceLocation LParenLoc,
11073 SourceLocation EndLoc);
11074 /// Called on well-formed 'flush' pseudo clause.
11076 SourceLocation StartLoc,
11077 SourceLocation LParenLoc,
11078 SourceLocation EndLoc);
11079 /// Called on well-formed 'depobj' pseudo clause.
11081 SourceLocation LParenLoc,
11082 SourceLocation EndLoc);
11083 /// Called on well-formed 'depend' clause.
11084 OMPClause *
11086 SourceLocation DepLoc, SourceLocation ColonLoc,
11087 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
11088 SourceLocation LParenLoc, SourceLocation EndLoc);
11089 /// Called on well-formed 'device' clause.
11091 Expr *Device, SourceLocation StartLoc,
11092 SourceLocation LParenLoc,
11093 SourceLocation ModifierLoc,
11094 SourceLocation EndLoc);
11095 /// Called on well-formed 'map' clause.
11096 OMPClause *
11098 ArrayRef<SourceLocation> MapTypeModifiersLoc,
11099 CXXScopeSpec &MapperIdScopeSpec,
11100 DeclarationNameInfo &MapperId,
11101 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
11102 SourceLocation MapLoc, SourceLocation ColonLoc,
11103 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
11104 ArrayRef<Expr *> UnresolvedMappers = llvm::None);
11105 /// Called on well-formed 'num_teams' clause.
11107 SourceLocation LParenLoc,
11108 SourceLocation EndLoc);
11109 /// Called on well-formed 'thread_limit' clause.
11111 SourceLocation StartLoc,
11112 SourceLocation LParenLoc,
11113 SourceLocation EndLoc);
11114 /// Called on well-formed 'priority' clause.
11116 SourceLocation LParenLoc,
11117 SourceLocation EndLoc);
11118 /// Called on well-formed 'dist_schedule' clause.
11120 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
11121 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
11122 SourceLocation CommaLoc, SourceLocation EndLoc);
11123 /// Called on well-formed 'defaultmap' clause.
11126 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
11127 SourceLocation KindLoc, SourceLocation EndLoc);
11128 /// Called on well-formed 'to' clause.
11129 OMPClause *
11131 ArrayRef<SourceLocation> MotionModifiersLoc,
11132 CXXScopeSpec &MapperIdScopeSpec,
11133 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
11134 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
11135 ArrayRef<Expr *> UnresolvedMappers = llvm::None);
11136 /// Called on well-formed 'from' clause.
11137 OMPClause *
11139 ArrayRef<SourceLocation> MotionModifiersLoc,
11140 CXXScopeSpec &MapperIdScopeSpec,
11141 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
11142 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
11143 ArrayRef<Expr *> UnresolvedMappers = llvm::None);
11144 /// Called on well-formed 'use_device_ptr' clause.
11146 const OMPVarListLocTy &Locs);
11147 /// Called on well-formed 'use_device_addr' clause.
11149 const OMPVarListLocTy &Locs);
11150 /// Called on well-formed 'is_device_ptr' clause.
11152 const OMPVarListLocTy &Locs);
11153 /// Called on well-formed 'nontemporal' clause.
11155 SourceLocation StartLoc,
11156 SourceLocation LParenLoc,
11157 SourceLocation EndLoc);
11158
11159 /// Data for list of allocators.
11161 /// Allocator.
11162 Expr *Allocator = nullptr;
11163 /// Allocator traits.
11165 /// Locations of '(' and ')' symbols.
11167 };
11168 /// Called on well-formed 'uses_allocators' clause.
11170 SourceLocation LParenLoc,
11171 SourceLocation EndLoc,
11173 /// Called on well-formed 'affinity' clause.
11175 SourceLocation LParenLoc,
11176 SourceLocation ColonLoc,
11177 SourceLocation EndLoc, Expr *Modifier,
11178 ArrayRef<Expr *> Locators);
11179
11180 /// The kind of conversion being performed.
11182 /// An implicit conversion.
11184 /// A C-style cast.
11186 /// A functional-style cast.
11188 /// A cast other than a C-style cast.
11190 /// A conversion for an operand of a builtin overloaded operator.
11193
11195 return CCK == CCK_CStyleCast || CCK == CCK_FunctionalCast ||
11196 CCK == CCK_OtherCast;
11197 }
11198
11199 /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
11200 /// cast. If there is already an implicit cast, merge into the existing one.
11201 /// If isLvalue, the result of the cast is an lvalue.
11204 const CXXCastPath *BasePath = nullptr,
11207
11208 /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
11209 /// to the conversion from scalar type ScalarTy to the Boolean type.
11211
11212 /// IgnoredValueConversions - Given that an expression's result is
11213 /// syntactically ignored, perform any conversions that are
11214 /// required.
11216
11217 // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
11218 // functions and arrays to their respective pointers (C99 6.3.2.1).
11220
11221 /// CallExprUnaryConversions - a special case of an unary conversion
11222 /// performed on a function designator of a call expression.
11224
11225 // DefaultFunctionArrayConversion - converts functions and arrays
11226 // to their respective pointers (C99 6.3.2.1).
11228
11229 // DefaultFunctionArrayLvalueConversion - converts functions and
11230 // arrays to their respective pointers and performs the
11231 // lvalue-to-rvalue conversion.
11233 bool Diagnose = true);
11234
11235 // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
11236 // the operand. This function is a no-op if the operand has a function type
11237 // or an array type.
11239
11240 // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
11241 // do not have a prototype. Integer promotions are performed on each
11242 // argument, and arguments that have type float are promoted to double.
11244
11245 /// If \p E is a prvalue denoting an unmaterialized temporary, materialize
11246 /// it as an xvalue. In C++98, the result will still be a prvalue, because
11247 /// we don't have xvalues there.
11249
11250 // Used for emitting the right warning by DefaultVariadicArgumentPromotion
11258
11260 const FunctionProtoType *Proto,
11261 Expr *Fn);
11262
11263 // Used for determining in which context a type is allowed to be passed to a
11264 // vararg function.
11272
11273 // Determines which VarArgKind fits an expression.
11275
11276 /// Check to see if the given expression is a valid argument to a variadic
11277 /// function, issuing a diagnostic if not.
11278 void checkVariadicArgument(const Expr *E, VariadicCallType CT);
11279
11280 /// Check to see if a given expression could have '.c_str()' called on it.
11281 bool hasCStrMethod(const Expr *E);
11282
11283 /// GatherArgumentsForCall - Collector argument expressions for various
11284 /// form of call prototypes.
11286 const FunctionProtoType *Proto,
11287 unsigned FirstParam, ArrayRef<Expr *> Args,
11288 SmallVectorImpl<Expr *> &AllArgs,
11290 bool AllowExplicit = false,
11291 bool IsListInitialization = false);
11292
11293 // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
11294 // will create a runtime trap if the resulting type is not a POD type.
11296 FunctionDecl *FDecl);
11297
11298 /// Context in which we're performing a usual arithmetic conversion.
11300 /// An arithmetic operation.
11302 /// A bitwise operation.
11304 /// A comparison.
11306 /// A conditional (?:) operator.
11308 /// A compound assignment expression.
11310 };
11311
11312 // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
11313 // operands and then handles various conversions that are common to binary
11314 // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
11315 // routine returns the first non-arithmetic type found. The client is
11316 // responsible for emitting appropriate error diagnostics.
11318 SourceLocation Loc, ArithConvKind ACK);
11319
11320 /// AssignConvertType - All of the 'assignment' semantic checks return this
11321 /// enum to indicate whether the assignment was allowed. These checks are
11322 /// done for simple assignments, as well as initialization, return from
11323 /// function, argument passing, etc. The query is phrased in terms of a
11324 /// source and destination type.
11326 /// Compatible - the types are compatible according to the standard.
11328
11329 /// PointerToInt - The assignment converts a pointer to an int, which we
11330 /// accept as an extension.
11332
11333 /// IntToPointer - The assignment converts an int to a pointer, which we
11334 /// accept as an extension.
11336
11337 /// FunctionVoidPointer - The assignment is between a function pointer and
11338 /// void*, which the standard doesn't allow, but we accept as an extension.
11340
11341 /// IncompatiblePointer - The assignment is between two pointers types that
11342 /// are not compatible, but we accept them as an extension.
11344
11345 /// IncompatibleFunctionPointer - The assignment is between two function
11346 /// pointers types that are not compatible, but we accept them as an
11347 /// extension.
11349
11350 /// IncompatiblePointerSign - The assignment is between two pointers types
11351 /// which point to integers which have a different sign, but are otherwise
11352 /// identical. This is a subset of the above, but broken out because it's by
11353 /// far the most common case of incompatible pointers.
11355
11356 /// CompatiblePointerDiscardsQualifiers - The assignment discards
11357 /// c/v/r qualifiers, which we accept as an extension.
11359
11360 /// IncompatiblePointerDiscardsQualifiers - The assignment
11361 /// discards qualifiers that we don't permit to be discarded,
11362 /// like address spaces.
11364
11365 /// IncompatibleNestedPointerAddressSpaceMismatch - The assignment
11366 /// changes address spaces in nested pointer types which is not allowed.
11367 /// For instance, converting __private int ** to __generic int ** is
11368 /// illegal even though __private could be converted to __generic.
11370
11371 /// IncompatibleNestedPointerQualifiers - The assignment is between two
11372 /// nested pointer types, and the qualifiers other than the first two
11373 /// levels differ e.g. char ** -> const char **, but we accept them as an
11374 /// extension.
11376
11377 /// IncompatibleVectors - The assignment is between two vector types that
11378 /// have the same size, which we accept as an extension.
11380
11381 /// IntToBlockPointer - The assignment converts an int to a block
11382 /// pointer. We disallow this.
11384
11385 /// IncompatibleBlockPointer - The assignment is between two block
11386 /// pointers types that are not compatible.
11388
11389 /// IncompatibleObjCQualifiedId - The assignment is between a qualified
11390 /// id type and something else (that is incompatible with it). For example,
11391 /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
11393
11394 /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
11395 /// object with __weak qualifier.
11397
11398 /// Incompatible - We reject this conversion outright, it is invalid to
11399 /// represent it in the AST.
11402
11403 /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
11404 /// assignment conversion type specified by ConvTy. This returns true if the
11405 /// conversion was invalid or false if the conversion was accepted.
11407 SourceLocation Loc,
11408 QualType DstType, QualType SrcType,
11409 Expr *SrcExpr, AssignmentAction Action,
11410 bool *Complained = nullptr);
11411
11412 /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
11413 /// enum. If AllowMask is true, then we also allow the complement of a valid
11414 /// value, to be used as a mask.
11415 bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
11416 bool AllowMask) const;
11417
11418 /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
11419 /// integer not in the range of enum values.
11420 void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
11421 Expr *SrcExpr);
11422
11423 /// CheckAssignmentConstraints - Perform type checking for assignment,
11424 /// argument passing, variable initialization, and function return values.
11425 /// C99 6.5.16.
11427 QualType LHSType,
11428 QualType RHSType);
11429
11430 /// Check assignment constraints and optionally prepare for a conversion of
11431 /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
11432 /// is true.
11434 ExprResult &RHS,
11435 CastKind &Kind,
11436 bool ConvertRHS = true);
11437
11438 /// Check assignment constraints for an assignment of RHS to LHSType.
11439 ///
11440 /// \param LHSType The destination type for the assignment.
11441 /// \param RHS The source expression for the assignment.
11442 /// \param Diagnose If \c true, diagnostics may be produced when checking
11443 /// for assignability. If a diagnostic is produced, \p RHS will be
11444 /// set to ExprError(). Note that this function may still return
11445 /// without producing a diagnostic, even for an invalid assignment.
11446 /// \param DiagnoseCFAudited If \c true, the target is a function parameter
11447 /// in an audited Core Foundation API and does not need to be checked
11448 /// for ARC retain issues.
11449 /// \param ConvertRHS If \c true, \p RHS will be updated to model the
11450 /// conversions necessary to perform the assignment. If \c false,
11451 /// \p Diagnose must also be \c false.
11453 QualType LHSType, ExprResult &RHS, bool Diagnose = true,
11454 bool DiagnoseCFAudited = false, bool ConvertRHS = true);
11455
11456 // If the lhs type is a transparent union, check whether we
11457 // can initialize the transparent union with the given expression.
11459 ExprResult &RHS);
11460
11462
11463 bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
11464
11466 AssignmentAction Action,
11467 bool AllowExplicit = false);
11469 const ImplicitConversionSequence& ICS,
11470 AssignmentAction Action,
11474 const StandardConversionSequence& SCS,
11475 AssignmentAction Action,
11477
11479 Expr *E, QualType Ty, ExprValueKind VK = VK_RValue,
11481
11482 /// the following "Check" methods will return a valid/converted QualType
11483 /// or a null QualType (indicating an error diagnostic was issued).
11484
11485 /// type checking binary operators (subroutines of CreateBuiltinBinOp).
11487 ExprResult &RHS);
11489 ExprResult &RHS);
11491 ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK,
11492 SourceLocation OpLoc, bool isIndirect);
11494 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign,
11495 bool IsDivide);
11496 QualType CheckRemainderOperands( // C99 6.5.5
11497 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
11498 bool IsCompAssign = false);
11499 QualType CheckAdditionOperands( // C99 6.5.6
11500 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
11501 BinaryOperatorKind Opc, QualType* CompLHSTy = nullptr);
11503 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
11504 QualType* CompLHSTy = nullptr);
11505 QualType CheckShiftOperands( // C99 6.5.7
11506 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
11507 BinaryOperatorKind Opc, bool IsCompAssign = false);
11509 QualType CheckCompareOperands( // C99 6.5.8/9
11510 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
11511 BinaryOperatorKind Opc);
11512 QualType CheckBitwiseOperands( // C99 6.5.[10...12]
11513 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
11514 BinaryOperatorKind Opc);
11515 QualType CheckLogicalOperands( // C99 6.5.[13,14]
11516 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
11517 BinaryOperatorKind Opc);
11518 // CheckAssignmentOperands is used for both simple and compound assignment.
11519 // For simple assignment, pass both expressions and a null converted type.
11520 // For compound assignment, pass both expressions and the converted type.
11521 QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
11522 Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType);
11523
11525 UnaryOperatorKind Opcode, Expr *Op);
11527 BinaryOperatorKind Opcode,
11528 Expr *LHS, Expr *RHS);
11531
11532 QualType CheckConditionalOperands( // C99 6.5.15
11533 ExprResult &Cond, ExprResult &LHS, ExprResult &RHS,
11534 ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc);
11536 ExprResult &cond, ExprResult &lhs, ExprResult &rhs,
11537 ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc);
11539 ExprResult &RHS,
11540 SourceLocation QuestionLoc);
11542 bool ConvertArgs = true);
11544 ExprResult &E1, ExprResult &E2,
11545 bool ConvertArgs = true) {
11546 Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
11547 QualType Composite =
11548 FindCompositePointerType(Loc, E1Tmp, E2Tmp, ConvertArgs);
11549 E1 = E1Tmp;
11550 E2 = E2Tmp;
11551 return Composite;
11552 }
11553
11555 SourceLocation QuestionLoc);
11556
11557 bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr,
11558 SourceLocation QuestionLoc);
11559
11562 bool IsEqual, SourceRange Range);
11563
11564 /// type checking for vector binary operators.
11566 SourceLocation Loc, bool IsCompAssign,
11567 bool AllowBothBool, bool AllowBoolConversion);
11570 SourceLocation Loc,
11571 BinaryOperatorKind Opc);
11573 SourceLocation Loc);
11574
11575 /// Type checking for matrix binary operators.
11577 SourceLocation Loc,
11578 bool IsCompAssign);
11580 SourceLocation Loc, bool IsCompAssign);
11581
11582 bool isValidSveBitcast(QualType srcType, QualType destType);
11583
11584 bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
11585 bool isLaxVectorConversion(QualType srcType, QualType destType);
11586
11587 /// type checking declaration initializers (C99 6.7.8)
11589
11590 // type checking C++ declaration initializers (C++ [dcl.init]).
11591
11592 /// ReferenceCompareResult - Expresses the result of comparing two
11593 /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
11594 /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
11596 /// Ref_Incompatible - The two types are incompatible, so direct
11597 /// reference binding is not possible.
11599 /// Ref_Related - The two types are reference-related, which means
11600 /// that their unqualified forms (T1 and T2) are either the same
11601 /// or T1 is a base class of T2.
11603 /// Ref_Compatible - The two types are reference-compatible.
11606
11607 // Fake up a scoped enumeration that still contextually converts to bool.
11609 /// The conversions that would be performed on an lvalue of type T2 when
11610 /// binding a reference of type T1 to it, as determined when evaluating
11611 /// whether T1 is reference-compatible with T2.
11615 Function = 0x4,
11617 ObjC = 0x10,
11619
11620 LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/ObjCLifetime)
11621 };
11622 };
11624
11627 ReferenceConversions *Conv = nullptr);
11628
11631 ExprValueKind &VK, CXXCastPath &Path);
11632
11633 /// Force an expression with unknown-type to an expression of the
11634 /// given type.
11636
11637 /// Type-check an expression that's being passed to an
11638 /// __unknown_anytype parameter.
11640 Expr *result, QualType &paramType);
11641
11642 // CheckVectorCast - check type constraints for vectors.
11643 // Since vectors are an extension, there are no C standard reference for this.
11644 // We allow casting between vectors and integer datatypes of the same size.
11645 // returns true if the cast is invalid
11646 bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
11647 CastKind &Kind);
11648
11649 /// Prepare `SplattedExpr` for a vector splat operation, adding
11650 /// implicit casts if necessary.
11651 ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr);
11652
11653 // CheckExtVectorCast - check type constraints for extended vectors.
11654 // Since vectors are an extension, there are no C standard reference for this.
11655 // We allow casting between vectors and integer datatypes of the same size,
11656 // or vectors and the element type of that vector.
11657 // returns the cast expr
11659 CastKind &Kind);
11660
11662 SourceLocation LParenLoc,
11663 Expr *CastExpr,
11664 SourceLocation RParenLoc);
11665
11667
11668 /// Checks for invalid conversions and casts between
11669 /// retainable pointers and other pointer kinds for ARC and Weak.
11671 QualType castType, Expr *&op,
11673 bool Diagnose = true,
11674 bool DiagnoseCFAudited = false,
11675 BinaryOperatorKind Opc = BO_PtrMemD
11676 );
11677
11680
11682 QualType ExprType);
11683
11684 /// checkRetainCycles - Check whether an Objective-C message send
11685 /// might create an obvious retain cycle.
11687 void checkRetainCycles(Expr *receiver, Expr *argument);
11688 void checkRetainCycles(VarDecl *Var, Expr *Init);
11689
11690 /// checkUnsafeAssigns - Check whether +1 expr is being assigned
11691 /// to weak/__unsafe_unretained type.
11692 bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS);
11693
11694 /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
11695 /// to weak/__unsafe_unretained expression.
11696 void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS);
11697
11698 /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
11699 /// \param Method - May be null.
11700 /// \param [out] ReturnType - The return type of the send.
11701 /// \return true iff there were any incompatible types.
11702 bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType,
11703 MultiExprArg Args, Selector Sel,
11704 ArrayRef<SourceLocation> SelectorLocs,
11705 ObjCMethodDecl *Method, bool isClassMessage,
11706 bool isSuperMessage, SourceLocation lbrac,
11707 SourceLocation rbrac, SourceRange RecRange,
11708 QualType &ReturnType, ExprValueKind &VK);
11709
11710 /// Determine the result of a message send expression based on
11711 /// the type of the receiver, the method expected to receive the message,
11712 /// and the form of the message send.
11713 QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType,
11714 ObjCMethodDecl *Method, bool isClassMessage,
11715 bool isSuperMessage);
11716
11717 /// If the given expression involves a message send to a method
11718 /// with a related result type, emit a note describing what happened.
11719 void EmitRelatedResultTypeNote(const Expr *E);
11720
11721 /// Given that we had incompatible pointer types in a return
11722 /// statement, check whether we're in a method with a related result
11723 /// type, and if so, emit a note describing what happened.
11725
11727 Decl *ConditionVar;
11728 FullExprArg Condition;
11729 bool Invalid;
11730 bool HasKnownValue;
11731 bool KnownValue;
11732
11733 friend class Sema;
11734 ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition,
11735 bool IsConstexpr)
11736 : ConditionVar(ConditionVar), Condition(Condition), Invalid(false),
11737 HasKnownValue(IsConstexpr && Condition.get() &&
11738 !Condition.get()->isValueDependent()),
11739 KnownValue(HasKnownValue &&
11740 !!Condition.get()->EvaluateKnownConstInt(S.Context)) {}
11741 explicit ConditionResult(bool Invalid)
11742 : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
11743 HasKnownValue(false), KnownValue(false) {}
11744
11745 public:
11747 bool isInvalid() const { return Invalid; }
11748 std::pair<VarDecl *, Expr *> get() const {
11749 return std::make_pair(cast_or_null<VarDecl>(ConditionVar),
11750 Condition.get());
11751 }
11753 if (!HasKnownValue)
11754 return None;
11755 return KnownValue;
11756 }
11757 };
11759
11760 enum class ConditionKind {
11761 Boolean, ///< A boolean condition, from 'if', 'while', 'for', or 'do'.
11762 ConstexprIf, ///< A constant boolean condition from 'if constexpr'.
11763 Switch ///< An integral condition for a 'switch' statement.
11764 };
11765
11766 ConditionResult ActOnCondition(Scope *S, SourceLocation Loc,
11767 Expr *SubExpr, ConditionKind CK);
11768
11769 ConditionResult ActOnConditionVariable(Decl *ConditionVar,
11770 SourceLocation StmtLoc,
11771 ConditionKind CK);
11772
11774
11776 SourceLocation StmtLoc,
11777 ConditionKind CK);
11779
11780 /// CheckBooleanCondition - Diagnose problems involving the use of
11781 /// the given expression as a boolean condition (e.g. in an if
11782 /// statement). Also performs the standard function and array
11783 /// decays, possibly changing the input variable.
11784 ///
11785 /// \param Loc - A location associated with the condition, e.g. the
11786 /// 'if' keyword.
11787 /// \return true iff there were any errors
11789 bool IsConstexpr = false);
11790
11791 /// ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression
11792 /// found in an explicit(bool) specifier.
11794
11795 /// tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
11796 /// Returns true if the explicit specifier is now resolved.
11798
11799 /// DiagnoseAssignmentAsCondition - Given that an expression is
11800 /// being used as a boolean condition, warn if it's an assignment.
11802
11803 /// Redundant parentheses over an equality comparison can indicate
11804 /// that the user intended an assignment used as condition.
11806
11807 /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
11808 ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
11809
11810 /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
11811 /// the specified width and sign. If an overflow occurs, detect it and emit
11812 /// the specified diagnostic.
11813 void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal,
11814 unsigned NewWidth, bool NewSign,
11815 SourceLocation Loc, unsigned DiagID);
11816
11817 /// Checks that the Objective-C declaration is declared in the global scope.
11818 /// Emits an error and marks the declaration as invalid if it's not declared
11819 /// in the global scope.
11820 bool CheckObjCDeclScope(Decl *D);
11821
11822 /// Abstract base class used for diagnosing integer constant
11823 /// expression violations.
11825 public:
11827
11829
11830 virtual SemaDiagnosticBuilder
11833 SourceLocation Loc) = 0;
11836 };
11837
11842
11843 /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
11844 /// and reports the appropriate diagnostics. Returns false on success.
11845 /// Can optionally return the value of the expression.
11847 VerifyICEDiagnoser &Diagnoser,
11848 AllowFoldKind CanFold = NoFold);
11850 unsigned DiagID,
11851 AllowFoldKind CanFold = NoFold);
11853 llvm::APSInt *Result = nullptr,
11854 AllowFoldKind CanFold = NoFold);
11856 AllowFoldKind CanFold = NoFold) {
11857 return VerifyIntegerConstantExpression(E, nullptr, CanFold);
11858 }
11859
11860 /// VerifyBitField - verifies that a bit field expression is an ICE and has
11861 /// the correct width, and that the field type is valid.
11862 /// Returns false on success.
11863 /// Can optionally return whether the bit-field is of width 0
11865 QualType FieldTy, bool IsMsStruct,
11866 Expr *BitWidth, bool *ZeroWidth = nullptr);
11867
11868private:
11869 unsigned ForceCUDAHostDeviceDepth = 0;
11870
11871public:
11872 /// Increments our count of the number of times we've seen a pragma forcing
11873 /// functions to be __host__ __device__. So long as this count is greater
11874 /// than zero, all functions encountered will be __host__ __device__.
11876
11877 /// Decrements our count of the number of times we've seen a pragma forcing
11878 /// functions to be __host__ __device__. Returns false if the count is 0
11879 /// before incrementing, so you can emit an error.
11881
11882 /// Diagnostics that are emitted only if we discover that the given function
11883 /// must be codegen'ed. Because handling these correctly adds overhead to
11884 /// compilation, this is currently only enabled for CUDA compilations.
11885 llvm::DenseMap<CanonicalDeclPtr<FunctionDecl>,
11886 std::vector<PartialDiagnosticAt>>
11888
11889 /// A pair of a canonical FunctionDecl and a SourceLocation. When used as the
11890 /// key in a hashtable, both the FD and location are hashed.
11895
11896 /// FunctionDecls and SourceLocations for which CheckCUDACall has emitted a
11897 /// (maybe deferred) "bad call" diagnostic. We use this to avoid emitting the
11898 /// same deferred diag twice.
11900
11901 /// An inverse call graph, mapping known-emitted functions to one of their
11902 /// known-emitted callers (plus the location of the call).
11903 ///
11904 /// Functions that we can tell a priori must be emitted aren't added to this
11905 /// map.
11906 llvm::DenseMap</* Callee = */ CanonicalDeclPtr<FunctionDecl>,
11907 /* Caller = */ FunctionDeclAndLoc>
11909
11910 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
11911 /// context is "used as device code".
11912 ///
11913 /// - If CurContext is a __host__ function, does not emit any diagnostics
11914 /// unless \p EmitOnBothSides is true.
11915 /// - If CurContext is a __device__ or __global__ function, emits the
11916 /// diagnostics immediately.
11917 /// - If CurContext is a __host__ __device__ function and we are compiling for
11918 /// the device, creates a diagnostic which is emitted if and when we realize
11919 /// that the function will be codegen'ed.
11920 ///
11921 /// Example usage:
11922 ///
11923 /// // Variable-length arrays are not allowed in CUDA device code.
11924 /// if (CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget())
11925 /// return ExprError();
11926 /// // Otherwise, continue parsing as normal.
11928 unsigned DiagID);
11929
11930 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
11931 /// context is "used as host code".
11932 ///
11933 /// Same as CUDADiagIfDeviceCode, with "host" and "device" switched.
11935
11936 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
11937 /// context is "used as device code".
11938 ///
11939 /// - If CurContext is a `declare target` function or it is known that the
11940 /// function is emitted for the device, emits the diagnostics immediately.
11941 /// - If CurContext is a non-`declare target` function and we are compiling
11942 /// for the device, creates a diagnostic which is emitted if and when we
11943 /// realize that the function will be codegen'ed.
11944 ///
11945 /// Example usage:
11946 ///
11947 /// // Variable-length arrays are not allowed in NVPTX device code.
11948 /// if (diagIfOpenMPDeviceCode(Loc, diag::err_vla_unsupported))
11949 /// return ExprError();
11950 /// // Otherwise, continue parsing as normal.
11952 diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD);
11953
11954 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
11955 /// context is "used as host code".
11956 ///
11957 /// - If CurContext is a `declare target` function or it is known that the
11958 /// function is emitted for the host, emits the diagnostics immediately.
11959 /// - If CurContext is a non-host function, just ignore it.
11960 ///
11961 /// Example usage:
11962 ///
11963 /// // Variable-length arrays are not allowed in NVPTX device code.
11964 /// if (diagIfOpenMPHostode(Loc, diag::err_vla_unsupported))
11965 /// return ExprError();
11966 /// // Otherwise, continue parsing as normal.
11968 unsigned DiagID, FunctionDecl *FD);
11969
11970 SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID,
11971 FunctionDecl *FD = nullptr);
11973 const PartialDiagnostic &PD,
11974 FunctionDecl *FD = nullptr) {
11975 return targetDiag(Loc, PD.getDiagID(), FD) << PD;
11976 }
11977
11978 /// Check if the expression is allowed to be used in expressions for the
11979 /// offloading devices.
11981
11989
11990 /// Determines whether the given function is a CUDA device/host/kernel/etc.
11991 /// function.
11992 ///
11993 /// Use this rather than examining the function's attributes yourself -- you
11994 /// will get it wrong. Returns CFT_Host if D is null.
11996 bool IgnoreImplicitHDAttr = false);
11998
11999 /// Gets the CUDA target for the current context.
12001 return IdentifyCUDATarget(dyn_cast<FunctionDecl>(CurContext));
12002 }
12003
12004 static bool isCUDAImplicitHostDeviceFunction(const FunctionDecl *D);
12005
12006 // CUDA function call preference. Must be ordered numerically from
12007 // worst to best.
12009 CFP_Never, // Invalid caller/callee combination.
12010 CFP_WrongSide, // Calls from host-device to host or device
12011 // function that do not match current compilation
12012 // mode.
12013 CFP_HostDevice, // Any calls to host/device functions.
12014 CFP_SameSide, // Calls from host-device to host or device
12015 // function matching current compilation mode.
12016 CFP_Native, // host-to-host or device-to-device calls.
12017 };
12018
12019 /// Identifies relative preference of a given Caller/Callee
12020 /// combination, based on their host/device attributes.
12021 /// \param Caller function which needs address of \p Callee.
12022 /// nullptr in case of global context.
12023 /// \param Callee target function
12024 ///
12025 /// \returns preference value for particular Caller/Callee combination.
12027 const FunctionDecl *Callee);
12028
12029 /// Determines whether Caller may invoke Callee, based on their CUDA
12030 /// host/device attributes. Returns false if the call is not allowed.
12031 ///
12032 /// Note: Will return true for CFP_WrongSide calls. These may appear in
12033 /// semantically correct CUDA programs, but only if they're never codegen'ed.
12035 const FunctionDecl *Callee) {
12036 return IdentifyCUDAPreference(Caller, Callee) != CFP_Never;
12037 }
12038
12039 /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD,
12040 /// depending on FD and the current compilation settings.
12042 const LookupResult &Previous);
12043
12044 /// May add implicit CUDAConstantAttr attribute to VD, depending on VD
12045 /// and current compilation settings.
12047
12048public:
12049 /// Check whether we're allowed to call Callee from the current context.
12050 ///
12051 /// - If the call is never allowed in a semantically-correct program
12052 /// (CFP_Never), emits an error and returns false.
12053 ///
12054 /// - If the call is allowed in semantically-correct programs, but only if
12055 /// it's never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to
12056 /// be emitted if and when the caller is codegen'ed, and returns true.
12057 ///
12058 /// Will only create deferred diagnostics for a given SourceLocation once,
12059 /// so you can safely call this multiple times without generating duplicate
12060 /// deferred errors.
12061 ///
12062 /// - Otherwise, returns true without emitting any diagnostics.
12063 bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee);
12064
12066
12067 /// Set __device__ or __host__ __device__ attributes on the given lambda
12068 /// operator() method.
12069 ///
12070 /// CUDA lambdas by default is host device function unless it has explicit
12071 /// host or device attribute.
12072 void CUDASetLambdaAttrs(CXXMethodDecl *Method);
12073
12074 /// Finds a function in \p Matches with highest calling priority
12075 /// from \p Caller context and erases all functions with lower
12076 /// calling priority.
12078 const FunctionDecl *Caller,
12079 SmallVectorImpl<std::pair<DeclAccessPair, FunctionDecl *>> &Matches);
12080
12081 /// Given a implicit special member, infer its CUDA target from the
12082 /// calls it needs to make to underlying base/field special members.
12083 /// \param ClassDecl the class for which the member is being created.
12084 /// \param CSM the kind of special member.
12085 /// \param MemberDecl the special member itself.
12086 /// \param ConstRHS true if this is a copy operation with a const object on
12087 /// its RHS.
12088 /// \param Diagnose true if this call should emit diagnostics.
12089 /// \return true if there was an error inferring.
12090 /// The result of this call is implicit CUDA target attribute(s) attached to
12091 /// the member declaration.
12093 CXXSpecialMember CSM,
12094 CXXMethodDecl *MemberDecl,
12095 bool ConstRHS,
12096 bool Diagnose);
12097
12098 /// \return true if \p CD can be considered empty according to CUDA
12099 /// (E.2.3.1 in CUDA 7.5 Programming guide).
12102
12103 // \brief Checks that initializers of \p Var satisfy CUDA restrictions. In
12104 // case of error emits appropriate diagnostic and invalidates \p Var.
12105 //
12106 // \details CUDA allows only empty constructors as initializers for global
12107 // variables (see E.2.3.1, CUDA 7.5). The same restriction also applies to all
12108 // __shared__ variables whether they are local or not (they all are implicitly
12109 // static in CUDA). One exception is that CUDA allows constant initializers
12110 // for __constant__ and __device__ variables.
12112
12113 /// Check whether NewFD is a valid overload for CUDA. Emits
12114 /// diagnostics and invalidates NewFD if not.
12116 const LookupResult &Previous);
12117 /// Copies target attributes from the template TD to the function FD.
12119
12120 /// Returns the name of the launch configuration function. This is the name
12121 /// of the function that will be called to configure kernel call, with the
12122 /// parameters specified via <<<>>>.
12123 std::string getCudaConfigureFuncName() const;
12124
12125 /// \name Code completion
12126 //@{
12127 /// Describes the context in which code completion occurs.
12129 /// Code completion occurs at top-level or namespace context.
12131 /// Code completion occurs within a class, struct, or union.
12133 /// Code completion occurs within an Objective-C interface, protocol,
12134 /// or category.
12136 /// Code completion occurs within an Objective-C implementation or
12137 /// category implementation
12139 /// Code completion occurs within the list of instance variables
12140 /// in an Objective-C interface, protocol, category, or implementation.
12142 /// Code completion occurs following one or more template
12143 /// headers.
12145 /// Code completion occurs following one or more template
12146 /// headers within a class.
12148 /// Code completion occurs within an expression.
12150 /// Code completion occurs within a statement, which may
12151 /// also be an expression or a declaration.
12153 /// Code completion occurs at the beginning of the
12154 /// initialization statement (or expression) in a for loop.
12156 /// Code completion occurs within the condition of an if,
12157 /// while, switch, or for statement.
12159 /// Code completion occurs within the body of a function on a
12160 /// recovery path, where we do not have a specific handle on our position
12161 /// in the grammar.
12163 /// Code completion occurs where only a type is permitted.
12165 /// Code completion occurs in a parenthesized expression, which
12166 /// might also be a type cast.
12168 /// Code completion occurs within a sequence of declaration
12169 /// specifiers within a function, method, or block.
12172
12175 ParserCompletionContext CompletionContext);
12176 void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
12177 bool AllowNonIdentifiers,
12178 bool AllowNestedNameSpecifiers);
12179
12180 struct CodeCompleteExpressionData;
12182 const CodeCompleteExpressionData &Data);
12183 void CodeCompleteExpression(Scope *S, QualType PreferredType,
12184 bool IsParenthesized = false);
12185 void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase,
12186 SourceLocation OpLoc, bool IsArrow,
12187 bool IsBaseExprStatement,
12188 QualType PreferredType);
12190 QualType PreferredType);
12191 void CodeCompleteTag(Scope *S, unsigned TagSpec);
12194 const VirtSpecifiers *VS = nullptr);
12196 void CodeCompleteCase(Scope *S);
12197 /// Reports signatures for a call to CodeCompleteConsumer and returns the
12198 /// preferred type for the current argument. Returned type can be null.
12200 SourceLocation OpenParLoc);
12202 SourceLocation Loc,
12203 ArrayRef<Expr *> Args,
12204 SourceLocation OpenParLoc);
12206 CXXScopeSpec SS,
12207 ParsedType TemplateTypeTy,
12208 ArrayRef<Expr *> ArgExprs,
12209 IdentifierInfo *II,
12210 SourceLocation OpenParLoc);
12211 void CodeCompleteInitializer(Scope *S, Decl *D);
12212 /// Trigger code completion for a record of \p BaseType. \p InitExprs are
12213 /// expressions in the initializer list seen so far and \p D is the current
12214 /// Designation being parsed.
12215 void CodeCompleteDesignator(const QualType BaseType,
12216 llvm::ArrayRef<Expr *> InitExprs,
12217 const Designation &D);
12218 void CodeCompleteAfterIf(Scope *S, bool IsBracedThen);
12219
12220 void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext,
12221 bool IsUsingDeclaration, QualType BaseType,
12222 QualType PreferredType);
12223 void CodeCompleteUsing(Scope *S);
12229 Decl *Constructor,
12230 ArrayRef<CXXCtorInitializer *> Initializers);
12231
12233 bool AfterAmpersand);
12235
12244 bool IsParameter);
12248 bool AtArgumentExpression);
12251 bool AtArgumentExpression,
12252 bool IsSuper = false);
12253 void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
12255 bool AtArgumentExpression,
12256 ObjCInterfaceDecl *Super = nullptr);
12258 DeclGroupPtrTy IterationVar);
12260 ArrayRef<IdentifierInfo *> SelIdents);
12262 ArrayRef<IdentifierLocPair> Protocols);
12266 IdentifierInfo *ClassName,
12267 SourceLocation ClassNameLoc);
12270 IdentifierInfo *ClassName,
12271 SourceLocation ClassNameLoc);
12273 IdentifierInfo *ClassName,
12274 SourceLocation ClassNameLoc);
12277 IdentifierInfo *PropertyName);
12278 void CodeCompleteObjCMethodDecl(Scope *S, Optional<bool> IsInstanceMethod,
12279 ParsedType ReturnType);
12281 bool IsInstanceMethod,
12282 bool AtParameterName,
12283 ParsedType ReturnType,
12284 ArrayRef<IdentifierInfo *> SelIdents);
12286 SourceLocation ClassNameLoc,
12287 bool IsBaseExprStatement);
12288 void CodeCompletePreprocessorDirective(bool InConditional);
12290 void CodeCompletePreprocessorMacroName(bool IsDefinition);
12293 IdentifierInfo *Macro,
12295 unsigned Argument);
12296 void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled);
12300 CodeCompletionTUInfo &CCTUInfo,
12302 //@}
12303
12304 //===--------------------------------------------------------------------===//
12305 // Extra semantic analysis beyond the C type system
12306
12307public:
12309 unsigned ByteNo) const;
12310
12311private:
12312 void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
12313 const ArraySubscriptExpr *ASE=nullptr,
12314 bool AllowOnePastEnd=true, bool IndexNegated=false);
12315 void CheckArrayAccess(const Expr *E);
12316 // Used to grab the relevant information from a FormatAttr and a
12317 // FunctionDeclaration.
12318 struct FormatStringInfo {
12319 unsigned FormatIdx;
12320 unsigned FirstDataArg;
12321 bool HasVAListArg;
12322 };
12323
12324 static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember,
12325 FormatStringInfo *FSI);
12326 bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
12327 const FunctionProtoType *Proto);
12328 bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc,
12329 ArrayRef<const Expr *> Args);
12330 bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
12331 const FunctionProtoType *Proto);
12332 bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto);
12333 void CheckConstructorCall(FunctionDecl *FDecl,
12334 ArrayRef<const Expr *> Args,
12335 const FunctionProtoType *Proto,
12336 SourceLocation Loc);
12337
12338 void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
12339 const Expr *ThisArg, ArrayRef<const Expr *> Args,
12340 bool IsMemberFunction, SourceLocation Loc, SourceRange Range,
12341 VariadicCallType CallType);
12342
12343 bool CheckObjCString(Expr *Arg);
12344 ExprResult CheckOSLogFormatStringArg(Expr *Arg);
12345
12346 ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl,
12347 unsigned BuiltinID, CallExpr *TheCall);
12348
12349 bool CheckTSBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
12350 CallExpr *TheCall);
12351
12352 void checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD, CallExpr *TheCall);
12353
12354 bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
12355 unsigned MaxWidth);
12356 bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
12357 CallExpr *TheCall);
12358 bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
12359 bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
12360 bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
12361 CallExpr *TheCall);
12362 bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg,
12363 bool WantCDE);
12364 bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
12365 CallExpr *TheCall);
12366
12367 bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
12368 CallExpr *TheCall);
12369 bool CheckBPFBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
12370 bool CheckHexagonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
12371 bool CheckHexagonBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
12372 bool CheckMipsBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
12373 CallExpr *TheCall);
12374 bool CheckMipsBuiltinCpu(const TargetInfo &TI, unsigned BuiltinID,
12375 CallExpr *TheCall);
12376 bool CheckMipsBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
12377 bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
12378 bool CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall);
12379 bool CheckX86BuiltinGatherScatterScale(unsigned BuiltinID, CallExpr *TheCall);
12380 bool CheckX86BuiltinTileArguments(unsigned BuiltinID, CallExpr *TheCall);
12381 bool CheckX86BuiltinTileArgumentsRange(CallExpr *TheCall,
12382 ArrayRef<int> ArgNums);
12383 bool CheckX86BuiltinTileDuplicate(CallExpr *TheCall, ArrayRef<int> ArgNums);
12384 bool CheckX86BuiltinTileRangeAndDuplicate(CallExpr *TheCall,
12385 ArrayRef<int> ArgNums);
12386 bool CheckX86BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
12387 CallExpr *TheCall);
12388 bool CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
12389 CallExpr *TheCall);
12390 bool CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
12391
12392 bool SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall);
12393 bool SemaBuiltinVAStartARMMicrosoft(CallExpr *Call);
12394 bool SemaBuiltinUnorderedCompare(CallExpr *TheCall);
12395 bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs);
12396 bool SemaBuiltinComplex(CallExpr *TheCall);
12397 bool SemaBuiltinVSX(CallExpr *TheCall);
12398 bool SemaBuiltinOSLogFormat(CallExpr *TheCall);
12399
12400public:
12401 // Used by C++ template instantiation.
12402 ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
12403 ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo,
12404 SourceLocation BuiltinLoc,
12405 SourceLocation RParenLoc);
12406
12407private:
12408 bool SemaBuiltinPrefetch(CallExpr *TheCall);
12409 bool SemaBuiltinAllocaWithAlign(CallExpr *TheCall);
12410 bool SemaBuiltinAssume(CallExpr *TheCall);
12411 bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
12412 bool SemaBuiltinLongjmp(CallExpr *TheCall);
12413 bool SemaBuiltinSetjmp(CallExpr *TheCall);
12414 ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
12415 ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult);
12416 ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult,
12418 ExprResult SemaBuiltinOperatorNewDeleteOverloaded(ExprResult TheCallResult,
12419 bool IsDelete);
12420 bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
12421 llvm::APSInt &Result);
12422 bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum, int Low,
12423 int High, bool RangeIsError = true);
12424 bool SemaBuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum,
12425 unsigned Multiple);
12426 bool SemaBuiltinConstantArgPower2(CallExpr *TheCall, int ArgNum);
12427 bool SemaBuiltinConstantArgShiftedByte(CallExpr *TheCall, int ArgNum,
12428 unsigned ArgBits);
12429 bool SemaBuiltinConstantArgShiftedByteOrXXFF(CallExpr *TheCall, int ArgNum,
12430 unsigned ArgBits);
12431 bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
12432 int ArgNum, unsigned ExpectedFieldNum,
12433 bool AllowName);
12434 bool SemaBuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall);
12435 bool SemaBuiltinPPCMMACall(CallExpr *TheCall, const char *TypeDesc);
12436
12437 bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc);
12438
12439 // Matrix builtin handling.
12440 ExprResult SemaBuiltinMatrixTranspose(CallExpr *TheCall,
12441 ExprResult CallResult);
12442 ExprResult SemaBuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
12443 ExprResult CallResult);
12444 ExprResult SemaBuiltinMatrixColumnMajorStore(CallExpr *TheCall,
12445 ExprResult CallResult);
12446
12447public:
12460 static FormatStringType GetFormatStringType(const FormatAttr *Format);
12461
12462 bool FormatStringHasSArg(const StringLiteral *FExpr);
12463
12464 static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
12465
12466private:
12467 bool CheckFormatArguments(const FormatAttr *Format,
12469 bool IsCXXMember,
12470 VariadicCallType CallType,
12471 SourceLocation Loc, SourceRange Range,
12472 llvm::SmallBitVector &CheckedVarArgs);
12473 bool CheckFormatArguments(ArrayRef<const Expr *> Args,
12474 bool HasVAListArg, unsigned format_idx,
12475 unsigned firstDataArg, FormatStringType Type,
12476 VariadicCallType CallType,
12477 SourceLocation Loc, SourceRange range,
12478 llvm::SmallBitVector &CheckedVarArgs);
12479
12480 void CheckAbsoluteValueFunction(const CallExpr *Call,
12481 const FunctionDecl *FDecl);
12482
12483 void CheckMaxUnsignedZero(const CallExpr *Call, const FunctionDecl *FDecl);
12484
12485 void CheckMemaccessArguments(const CallExpr *Call,
12486 unsigned BId,
12487 IdentifierInfo *FnName);
12488
12489 void CheckStrlcpycatArguments(const CallExpr *Call,
12490 IdentifierInfo *FnName);
12491
12492 void CheckStrncatArguments(const CallExpr *Call,
12493 IdentifierInfo *FnName);
12494
12495 void CheckFreeArguments(const CallExpr *E);
12496
12497 void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
12498 SourceLocation ReturnLoc,
12499 bool isObjCMethod = false,
12500 const AttrVec *Attrs = nullptr,
12501 const FunctionDecl *FD = nullptr);
12502
12503public:
12504 void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS);
12505
12506private:
12507 void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
12508 void CheckBoolLikeConversion(Expr *E, SourceLocation CC);
12509 void CheckForIntOverflow(Expr *E);
12510 void CheckUnsequencedOperations(const Expr *E);
12511
12512 /// Perform semantic checks on a completed expression. This will either
12513 /// be a full-expression or a default argument expression.
12514 void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(),
12515 bool IsConstexpr = false);
12516
12517 void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field,
12518 Expr *Init);
12519
12520 /// Check if there is a field shadowing.
12521 void CheckShadowInheritedFields(const SourceLocation &Loc,
12522 DeclarationName FieldName,
12523 const CXXRecordDecl *RD,
12524 bool DeclIsField = true);
12525
12526 /// Check if the given expression contains 'break' or 'continue'
12527 /// statement that produces control flow different from GCC.
12528 void CheckBreakContinueBinding(Expr *E);
12529
12530 /// Check whether receiver is mutable ObjC container which
12531 /// attempts to add itself into the container
12532 void CheckObjCCircularContainer(ObjCMessageExpr *Message);
12533
12534 void CheckTCBEnforcement(const CallExpr *TheCall, const FunctionDecl *Callee);
12535
12536 void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
12537 void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc,
12538 bool DeleteWasArrayForm);
12539public:
12540 /// Register a magic integral constant to be used as a type tag.
12541 void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
12542 uint64_t MagicValue, QualType Type,
12543 bool LayoutCompatible, bool MustBeNull);
12544
12547
12552
12554
12555 /// If true, \c Type should be compared with other expression's types for
12556 /// layout-compatibility.
12557 unsigned LayoutCompatible : 1;
12558 unsigned MustBeNull : 1;
12559 };
12560
12561 /// A pair of ArgumentKind identifier and magic value. This uniquely
12562 /// identifies the magic value.
12563 typedef std::pair<const IdentifierInfo *, uint64_t> TypeTagMagicValue;
12564
12565private:
12566 /// A map from magic value to type information.
12567 std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
12568 TypeTagForDatatypeMagicValues;
12569
12570 /// Peform checks on a call of a function with argument_with_type_tag
12571 /// or pointer_with_type_tag attributes.
12572 void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
12573 const ArrayRef<const Expr *> ExprArgs,
12574 SourceLocation CallSiteLoc);
12575
12576 /// Check if we are taking the address of a packed field
12577 /// as this may be a problem if the pointer value is dereferenced.
12578 void CheckAddressOfPackedMember(Expr *rhs);
12579
12580 /// The parser's current scope.
12581 ///
12582 /// The parser maintains this state here.
12583 Scope *CurScope;
12584
12585 mutable IdentifierInfo *Ident_super;
12586 mutable IdentifierInfo *Ident___float128;
12587
12588 /// Nullability type specifiers.
12589 IdentifierInfo *Ident__Nonnull = nullptr;
12590 IdentifierInfo *Ident__Nullable = nullptr;
12591 IdentifierInfo *Ident__Nullable_result = nullptr;
12592 IdentifierInfo *Ident__Null_unspecified = nullptr;
12593
12594 IdentifierInfo *Ident_NSError = nullptr;
12595
12596 /// The handler for the FileChanged preprocessor events.
12597 ///
12598 /// Used for diagnostics that implement custom semantic analysis for #include
12599 /// directives, like -Wpragma-pack.
12600 sema::SemaPPCallbacks *SemaPPCallbackHandler;
12601
12602protected:
12603 friend class Parser;
12605 friend class ASTReader;
12606 friend class ASTDeclReader;
12607 friend class ASTWriter;
12608
12609public:
12610 /// Retrieve the keyword associated
12612
12613 /// The struct behind the CFErrorRef pointer.
12615 bool isCFError(RecordDecl *D);
12616
12617 /// Retrieve the identifier "NSError".
12619
12620 /// Retrieve the parser's current scope.
12621 ///
12622 /// This routine must only be used when it is certain that semantic analysis
12623 /// and the parser are in precisely the same context, which is not the case
12624 /// when, e.g., we are performing any kind of template instantiation.
12625 /// Therefore, the only safe places to use this scope are in the parser
12626 /// itself and in routines directly invoked from the parser and *never* from
12627 /// template substitution or instantiation.
12628 Scope *getCurScope() const { return CurScope; }
12629
12631 return CurScope->incrementMSManglingNumber();
12632 }
12633
12636
12637 Decl *getObjCDeclContext() const;
12638
12642
12644 const DeclContext *DC = getCurLexicalContext();
12645 // A category implicitly has the attribute of the interface.
12646 if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
12647 DC = CatD->getClassInterface();
12648 return DC;
12649 }
12650
12651 /// Determine the number of levels of enclosing template parameters. This is
12652 /// only usable while parsing. Note that this does not include dependent
12653 /// contexts in which no template parameters have yet been declared, such as
12654 /// in a terse function template or generic lambda before the first 'auto' is
12655 /// encountered.
12656 unsigned getTemplateDepth(Scope *S) const;
12657
12658 /// To be used for checking whether the arguments being passed to
12659 /// function exceeds the number of parameters expected for it.
12660 static bool TooManyArguments(size_t NumParams, size_t NumArgs,
12661 bool PartialOverloading = false) {
12662 // We check whether we're just after a comma in code-completion.
12663 if (NumArgs > 0 && PartialOverloading)
12664 return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
12665 return NumArgs > NumParams;
12666 }
12667
12668 // Emitting members of dllexported classes is delayed until the class
12669 // (including field initializers) is fully parsed.
12672
12673private:
12674 int ParsingClassDepth = 0;
12675
12676 class SavePendingParsedClassStateRAII {
12677 public:
12678 SavePendingParsedClassStateRAII(Sema &S) : S(S) { swapSavedState(); }
12679
12680 ~SavePendingParsedClassStateRAII() {
12681 assert(S.DelayedOverridingExceptionSpecChecks.empty() &&
12682 "there shouldn't be any pending delayed exception spec checks");
12683 assert(S.DelayedEquivalentExceptionSpecChecks.empty() &&
12684 "there shouldn't be any pending delayed exception spec checks");
12685 swapSavedState();
12686 }
12687
12688 private:
12689 Sema &S;
12691 SavedOverridingExceptionSpecChecks;
12693 SavedEquivalentExceptionSpecChecks;
12694
12695 void swapSavedState() {
12696 SavedOverridingExceptionSpecChecks.swap(
12697 S.DelayedOverridingExceptionSpecChecks);
12698 SavedEquivalentExceptionSpecChecks.swap(
12699 S.DelayedEquivalentExceptionSpecChecks);
12700 }
12701 };
12702
12703 /// Helper class that collects misaligned member designations and
12704 /// their location info for delayed diagnostics.
12705 struct MisalignedMember {
12706 Expr *E;
12707 RecordDecl *RD;
12708 ValueDecl *MD;
12709 CharUnits Alignment;
12710
12711 MisalignedMember() : E(), RD(), MD(), Alignment() {}
12712 MisalignedMember(Expr *E, RecordDecl *RD, ValueDecl *MD,
12713 CharUnits Alignment)
12714 : E(E), RD(RD), MD(MD), Alignment(Alignment) {}
12715 explicit MisalignedMember(Expr *E)
12716 : MisalignedMember(E, nullptr, nullptr, CharUnits()) {}
12717
12718 bool operator==(const MisalignedMember &m) { return this->E == m.E; }
12719 };
12720 /// Small set of gathered accesses to potentially misaligned members
12721 /// due to the packed attribute.
12722 SmallVector<MisalignedMember, 4> MisalignedMembers;
12723
12724 /// Adds an expression to the set of gathered misaligned members.
12725 void AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD,
12726 CharUnits Alignment);
12727
12728public:
12729 /// Diagnoses the current set of gathered accesses. This typically
12730 /// happens at full expression level. The set is cleared after emitting the
12731 /// diagnostics.
12733
12734 /// This function checks if the expression is in the sef of potentially
12735 /// misaligned members and it is converted to some pointer type T with lower
12736 /// or equal alignment requirements. If so it removes it. This is used when
12737 /// we do not want to diagnose such misaligned access (e.g. in conversions to
12738 /// void*).
12739 void DiscardMisalignedMemberAddress(const Type *T, Expr *E);
12740
12741 /// This function calls Action when it determines that E designates a
12742 /// misaligned member due to the packed attribute. This is used to emit
12743 /// local diagnostics like in reference binding.
12745 Expr *E,
12746 llvm::function_ref<void(Expr *, RecordDecl *, FieldDecl *, CharUnits)>
12747 Action);
12748
12749 /// Describes the reason a calling convention specification was ignored, used
12750 /// for diagnostics.
12757 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
12758 /// context is "used as device code".
12759 ///
12760 /// - If CurLexicalContext is a kernel function or it is known that the
12761 /// function will be emitted for the device, emits the diagnostics
12762 /// immediately.
12763 /// - If CurLexicalContext is a function and we are compiling
12764 /// for the device, but we don't know that this function will be codegen'ed
12765 /// for devive yet, creates a diagnostic which is emitted if and when we
12766 /// realize that the function will be codegen'ed.
12767 ///
12768 /// Example usage:
12769 ///
12770 /// Diagnose __float128 type usage only from SYCL device code if the current
12771 /// target doesn't support it
12772 /// if (!S.Context.getTargetInfo().hasFloat128Type() &&
12773 /// S.getLangOpts().SYCLIsDevice)
12774 /// SYCLDiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
12775 SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc,
12776 unsigned DiagID);
12777
12778 /// Check whether we're allowed to call Callee from the current context.
12779 ///
12780 /// - If the call is never allowed in a semantically-correct program
12781 /// emits an error and returns false.
12782 ///
12783 /// - If the call is allowed in semantically-correct programs, but only if
12784 /// it's never codegen'ed, creates a deferred diagnostic to be emitted if
12785 /// and when the caller is codegen'ed, and returns true.
12786 ///
12787 /// - Otherwise, returns true without emitting any diagnostics.
12788 ///
12789 /// Adds Callee to DeviceCallGraph if we don't know if its caller will be
12790 /// codegen'ed yet.
12792};
12793
12794/// RAII object that enters a new expression evaluation context.
12796 Sema &Actions;
12797 bool Entered = true;
12798
12799public:
12801 Sema &Actions, Sema::ExpressionEvaluationContext NewContext,
12802 Decl *LambdaContextDecl = nullptr,
12805 bool ShouldEnter = true)
12806 : Actions(Actions), Entered(ShouldEnter) {
12807 if (Entered)
12808 Actions.PushExpressionEvaluationContext(NewContext, LambdaContextDecl,
12809 ExprContext);
12810 }
12820
12823 bool ShouldEnter = true)
12824 : Actions(Actions), Entered(false) {
12825 // In C++11 onwards, narrowing checks are performed on the contents of
12826 // braced-init-lists, even when they occur within unevaluated operands.
12827 // Therefore we still need to instantiate constexpr functions used in such
12828 // a context.
12829 if (ShouldEnter && Actions.isUnevaluatedContext() &&
12830 Actions.getLangOpts().CPlusPlus11) {
12831 Actions.PushExpressionEvaluationContext(
12832 Sema::ExpressionEvaluationContext::UnevaluatedList);
12833 Entered = true;
12834 }
12835 }
12836
12838 if (Entered)
12840 }
12841};
12842
12843DeductionFailureInfo
12845 sema::TemplateDeductionInfo &Info);
12846
12847/// Contains a late templated function.
12848/// Will be parsed at the end of the translation unit, used by Sema & Parser.
12851 /// The template function declaration to be late parsed.
12853};
12854
12855template <>
12857 PragmaMsStackAction Action,
12858 llvm::StringRef StackSlotLabel,
12860
12861} // end namespace clang
12862
12863namespace llvm {
12864// Hash a FunctionDeclAndLoc by looking at both its FunctionDecl and its
12865// SourceLocation.
12866template <> struct DenseMapInfo<clang::Sema::FunctionDeclAndLoc> {
12869
12871 return {FDBaseInfo::getEmptyKey(), clang::SourceLocation()};
12872 }
12873
12875 return {FDBaseInfo::getTombstoneKey(), clang::SourceLocation()};
12876 }
12877
12878 static unsigned getHashValue(const FunctionDeclAndLoc &FDL) {
12879 return hash_combine(FDBaseInfo::getHashValue(FDL.FD),
12880 FDL.Loc.getHashValue());
12881 }
12882
12883 static bool isEqual(const FunctionDeclAndLoc &LHS,
12884 const FunctionDeclAndLoc &RHS) {
12885 return LHS.FD == RHS.FD && LHS.Loc == RHS.Loc;
12886 }
12887};
12888} // namespace llvm
12889
12890#endif
This file provides AST data structures related to concepts.
#define V(N, I)
int Id
Definition ASTDiff.cpp:191
Forward declaration of all AST node types.
MatchType Type
StringRef P
#define SM(sm)
Definition Cuda.cpp:62
Provides LLVM's BitmaskEnum facility to enumeration types declared in namespace clang.
auto * N
llvm::APSInt APSInt
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Defines enumerations for expression traits intrinsics.
Token Tok
The Token.
FormatToken * Previous
The previous token in the unwrapped line.
unsigned Offset
Definition Format.cpp:2113
bool IsStatic
Definition Format.cpp:2123
StringRef Identifier
Definition Format.cpp:2119
Defines the clang::Module class, which describes a module in the source code.
Defines the clang::OpenCLOptions class.
Defines some OpenMP-specific enums and functions.
AccessResult
A copy of Sema's enum without AR_delayed.
CastType
Definition SemaCast.cpp:45
Sema::AllowedExplicit AllowedExplicit
Defines various enumerations that describe declaration and type specifiers.
Defines the clang::TemplateNameKind enum.
Defines the clang::TypeLoc interface and its subclasses.
Allows QualTypes to be sorted and hence used in maps and sets.
Defines enumerations for the type traits support.
TypePropertyCache< Private > Cache
Definition Type.cpp:3807
SourceLocation Begin
std::string Label
A class for storing results from argument-dependent lookup.
Definition Lookup.h:798
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition APValue.h:122
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition ASTConsumer.h:33
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:187
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Reads an AST files chain containing the contents of a translation unit.
Definition ASTReader.h:349
Writes an AST file containing the contents of a translation unit.
Definition ASTWriter.h:100
Represents an access specifier followed by colon ':'.
Definition DeclCXX.h:86
bool isInvalid() const
Definition Ownership.h:165
PtrTy get() const
Definition Ownership.h:169
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition Expr.h:2574
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition Type.h:2867
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition Type.h:2873
Attr - This represents one attribute.
Definition Attr.h:46
An attributed type is a type to which a type attribute has been applied.
Definition Type.h:4660
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition Type.h:4972
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition Decl.h:4100
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a base class of a C++ class.
Definition DeclCXX.h:146
Represents a C++ constructor within a class.
Definition DeclCXX.h:2393
Represents a C++ conversion function within a class.
Definition DeclCXX.h:2720
Represents a C++ base or member initializer.
Definition DeclCXX.h:2162
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition ExprCXX.h:2398
Represents a C++ destructor within a class.
Definition DeclCXX.h:2656
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:1937
Represents a C++ struct/union/class.
Definition DeclCXX.h:254
Represents a C++ nested-name-specifier or a global scope specifier.
Definition DeclSpec.h:64
Represents the this expression in C++.
Definition ExprCXX.h:1142
CXXTryStmt - A C++ try block, including all handlers.
Definition StmtCXX.h:69
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2730
A wrapper class around a pointer that always points to its canonical declaration.
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition Decl.h:4292
CaseStmt - Represent a case statement.
Definition Stmt.h:1568
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3397
CharUnits - This is an opaque type for sizes expressed in character units.
Definition CharUnits.h:38
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Abstract interface for a consumer of code-completion information.
An allocator used specifically for the purpose of code completion.
Declaration of a C++2a concept.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition ASTConcept.h:29
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition DeclCXX.h:3269
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
Definition DeclBase.h:1227
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1302
A reference to a declared variable, function, enum, etc.
Definition Expr.h:1217
Captures information about "declaration specifiers".
Definition DeclSpec.h:229
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:89
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Definition DeclBase.h:789
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition DeclBase.h:773
The name of a declaration.
Represents a ValueDecl that came out of a declarator.
Definition Decl.h:686
Information about one declarator, including the parsed type information and the identifier.
Definition DeclSpec.h:1803
A decomposition declaration.
Definition DeclCXX.h:3877
A dependently-generated diagnostic.
Designation - Represent a full designation, which is a sequence of designators.
Definition Designator.h:185
A little helper class used to produce diagnostics.
void Clear() const
Clear out the current diagnostic.
bool isActive() const
Determine whether this diagnostic is still active.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:191
void setLastDiagnosticIgnored(bool Ignored)
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed,...
Definition Diagnostic.h:716
RAII object that enters a new expression evaluation context.
Definition Sema.h:12795
EnterExpressionEvaluationContext(Sema &Actions, InitListTag, bool ShouldEnter=true)
Definition Sema.h:12822
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Sema::ReuseLambdaContextDecl_t, Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext=Sema::ExpressionEvaluationContextRecord::EK_Other)
Definition Sema.h:12811
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext=Sema::ExpressionEvaluationContextRecord::EK_Other, bool ShouldEnter=true)
Definition Sema.h:12800
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:2997
Represents an enum.
Definition Decl.h:3537
Store information needed for an explicit specifier.
Definition DeclCXX.h:1793
Represents a C++ Modules TS module export declaration.
Definition Decl.h:4474
The return type of classify().
Definition Expr.h:325
This represents one expression.
Definition Expr.h:109
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant().
Definition Expr.h:747
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition Expr.cpp:228
An abstract interface that should be implemented by external AST sources that also provide informatio...
virtual void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs)
Read the set of tentative definitions known to the external Sema source.
virtual void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls)
Read the set of unused file-scope declarations known to the external Sema source.
virtual void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls)
Read the set of ext_vector type declarations known to the external Sema source.
virtual void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls)
Read the set of delegating constructors known to the external Sema source.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Definition Decl.h:2782
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
A mapping from file IDs to a record of whether we've seen nullability information in that file.
Definition Sema.h:261
FileNullability & operator[](FileID file)
Definition Sema.h:272
FileNullability Nullability
Definition Sema.h:268
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Definition Diagnostic.h:70
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Definition DeclFriend.h:55
Represents a function declaration or definition.
Definition Decl.h:1813
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition ExprCXX.h:4382
Represents a prototype with parameter type info, e.g.
Definition Type.h:3883
Declaration of a template function.
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
Definition Type.h:3564
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition Type.h:3538
One of these records is kept for each identifier that is lexed.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition Overload.h:516
Represents a field injected from an anonymous union/struct into the parent scope.
Definition Decl.h:3037
Describes an C or C++ initializer list.
Definition Expr.h:4710
Describes the kind of initialization being performed, along with location information for tokens rela...
Describes the sequence of initializations required to initialize a given object or reference with a s...
Describes an entity that is being initialized.
Represents the declaration of a label.
Definition Decl.h:466
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition LangOptions.h:58
FPExceptionModeKind
Possible floating point exception behavior.
Represents a lazily-loaded vector of data.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
Definition Template.h:270
Represents the results of name lookup.
Definition Lookup.h:46
A global _GUID constant.
Definition DeclCXX.h:4000
An instance of this class represents the declaration of a property member.
Definition DeclCXX.h:3946
Encapsulates the data about a macro definition (e.g.
Definition MacroInfo.h:39
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition ExprCXX.h:4462
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3090
Abstract interface for a module loader.
Describes a module or submodule.
Definition Module.h:96
Data structure that captures multiple levels of template argument lists for use in template instantia...
Definition Template.h:75
static const unsigned NumNSNumberLiteralMethods
Definition NSAPI.h:191
This represents a decl that may have a name.
Definition Decl.h:223
bool isExternallyDeclarable() const
Determine whether this declaration can be redeclared in a different translation unit.
Definition Decl.h:383
Represent a C++ namespace.
Definition Decl.h:514
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
This is a basic class for representing single OpenMP clause.
This represents '#pragma omp declare reduction ...' directive.
Definition DeclOpenMP.h:171
This represents '#pragma omp requires...' directive.
Definition DeclOpenMP.h:416
This represents '#pragma omp threadprivate ...' directive.
Definition DeclOpenMP.h:110
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
ObjCCategoryDecl - Represents a category declaration.
Definition DeclObjC.h:2266
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition DeclObjC.h:2485
ObjCContainerDecl - Represents a container for method declarations.
Definition DeclObjC.h:947
Captures information about "declaration specifiers" specific to Objective-C.
Definition DeclSpec.h:822
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition DeclObjC.h:2538
Represents an ObjC class declaration.
Definition DeclObjC.h:1151
ObjCIvarDecl - Represents an ObjC instance variable.
Definition DeclObjC.h:1923
ObjCList - This is a simple template class used to hold various lists of decls etc,...
Definition Sema.h:159
An expression that sends a message to the given Objective-C object or class.
Definition ExprObjC.h:942
ObjCMethodDecl - Represents an instance or class method declaration.
Definition DeclObjC.h:139
Represents a pointer to an Objective C object.
Definition Type.h:6060
Represents a class type in Objective C.
Definition Type.h:5804
Represents one property declaration in an Objective-C interface.
Definition DeclObjC.h:729
Represents an Objective-C protocol declaration.
Definition DeclObjC.h:2043
Represents the declaration of an Objective-C type parameter.
Definition DeclObjC.h:579
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition DeclObjC.h:658
Wrapper for void* pointer.
Definition Ownership.h:50
static OpaquePtr make(QualType P)
Definition Ownership.h:60
OpenCL supported extensions and optional core features.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
Definition Overload.h:919
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition ExprCXX.h:2880
ParenExpr - This represents a parethesized expression, e.g.
Definition Expr.h:2042
Represents a parameter to a function.
Definition Decl.h:1620
ParsedAttr - Represents a syntactic attribute.
Definition ParsedAttr.h:200
ParsedAttributes - A collection of parsed attributes.
Definition ParsedAttr.h:914
Represents the parsed form of a C++ template argument.
Parser - This implements a parser for the C family of languages.
Definition Parser.h:60
void Emit(const DiagnosticBuilder &DB) const
Keeps track of expected type during expression parsing.
Definition Sema.h:293
void enterFunctionArgument(SourceLocation Tok, llvm::function_ref< QualType()> ComputeType)
Computing a type for the function argument may require running overloading, so we postpone its comput...
void enterCondition(Sema &S, SourceLocation Tok)
void enterTypeCast(SourceLocation Tok, QualType CastType)
Handles all type casts, including C-style cast, C++ casts, etc.
void enterMemAccess(Sema &S, SourceLocation Tok, Expr *Base)
void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS)
void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind, SourceLocation OpLoc)
void enterReturn(Sema &S, SourceLocation Tok)
void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op)
PreferredTypeBuilder(QualType Type)
Definition Sema.h:296
void enterParenExpr(SourceLocation Tok, SourceLocation LParLoc)
void enterVariableInit(SourceLocation Tok, Decl *D)
QualType get(SourceLocation Tok) const
Definition Sema.h:319
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Stores the type being destroyed by a pseudo-destructor expression.
Definition ExprCXX.h:2466
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition Expr.h:6021
A (possibly-)qualified type.
Definition Type.h:661
The collection of all-type qualifiers we support.
Definition Type.h:145
Represents a struct/union/class.
Definition Decl.h:3806
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition Type.h:4605
Represents the body of a requires-expression.
Definition DeclCXX.h:1915
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Scope - A scope is a transient data structure that is used while parsing the program.
Definition Scope.h:40
void incrementMSManglingNumber()
Definition Scope.h:297
Smart pointer class that efficiently represents Objective-C method names.
AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
Definition Sema.h:484
bool operator==(const AlignPackInfo &Info) const
Definition Sema.h:544
static AlignPackInfo getFromRawEncoding(unsigned Encoding)
Definition Sema.h:516
unsigned getPackNumber() const
Definition Sema.h:534
bool IsXLStack() const
Definition Sema.h:542
bool IsPackSet() const
Definition Sema.h:536
AlignPackInfo(AlignPackInfo::Mode M, bool IsXL)
Definition Sema.h:490
bool IsAlignAttr() const
Definition Sema.h:530
bool IsPackAttr() const
Definition Sema.h:528
bool operator!=(const AlignPackInfo &Info) const
Definition Sema.h:550
AlignPackInfo(bool IsXL)
Definition Sema.h:494
static uint32_t getRawEncoding(const AlignPackInfo &Info)
Definition Sema.h:501
Mode getAlignMode() const
Definition Sema.h:532
RAII object used to change the argument pack substitution index within a Sema object.
Definition Sema.h:8742
ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
Definition Sema.h:8747
BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition Sema.h:2047
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition Sema.h:2052
void emit(const SemaDiagnosticBuilder &DB, std::index_sequence< Is... >) const
Definition Sema.h:2039
std::tuple< const Ts &... > Args
Definition Sema.h:2036
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Definition Sema.h:6095
CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals, bool Enabled=true)
Introduce a new scope where 'this' may be allowed (when enabled), using the given declaration (which ...
A RAII object to enter scope of a compound statement.
Definition Sema.h:4585
CompoundScopeRAII(Sema &S, bool IsStmtExpr=false)
Definition Sema.h:4587
std::pair< VarDecl *, Expr * > get() const
Definition Sema.h:11748
llvm::Optional< bool > getKnownValue() const
Definition Sema.h:11752
A RAII object to temporarily push a declaration context.
Definition Sema.h:968
ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext=true)
Definition Sema.h:978
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
Definition Sema.h:3472
virtual SemaDiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for one of the candidate conversions.
virtual SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
virtual SemaDiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for the explicit conversion function.
virtual SemaDiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when the only matching conversion function is explicit.
virtual SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when we picked a conversion function (for cases when we are not allowed to pick a ...
virtual SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when there are multiple possible conversion functions.
ContextualImplicitConverter(bool Suppress=false, bool SuppressConversion=false)
Definition Sema.h:3477
virtual bool match(QualType T)=0
Determine whether the specified type is a valid destination type for this conversion.
virtual SemaDiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when the expression has incomplete class type.
For a defaulted function, the kind of defaulted function that it is.
Definition Sema.h:3039
DefaultedComparisonKind asComparison() const
Definition Sema.h:3062
DefaultedFunctionKind(CXXSpecialMember CSM)
Definition Sema.h:3047
CXXSpecialMember asSpecialMember() const
Definition Sema.h:3061
unsigned getDiagnosticIndex() const
Get the index of this function kind for use in diagnostics.
Definition Sema.h:3065
DefaultedFunctionKind(DefaultedComparisonKind Comp)
Definition Sema.h:3049
A class which encapsulates the logic for delaying diagnostics during parsing and other processing.
Definition Sema.h:916
DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool)
Enter a new scope.
Definition Sema.h:937
void popUndelayed(DelayedDiagnosticsState state)
Undo a previous pushUndelayed().
Definition Sema.h:961
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
Definition Sema.h:928
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
Definition Sema.h:931
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
void popWithoutEmitting(DelayedDiagnosticsState state)
Leave a delayed-diagnostic state that was previously pushed.
Definition Sema.h:947
DelayedDiagnosticsState pushUndelayed()
Enter a new scope where access and deprecation diagnostics are not delayed.
Definition Sema.h:953
A helper class for building up ExtParameterInfos.
Definition Sema.h:9161
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
Definition Sema.h:9180
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Definition Sema.h:9168
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Definition Sema.h:1487
FPOptionsOverride getOverrides()
Definition Sema.h:1496
FullExprArg(Sema &actions)
Definition Sema.h:4536
ExprResult release()
Definition Sema.h:4538
Expr * get() const
Definition Sema.h:4542
GlobalEagerInstantiationScope(Sema &S, bool Enabled)
Definition Sema.h:9085
SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) override
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
Definition Sema.h:3533
virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
bool match(QualType T) override
Match an integral or (possibly scoped) enumeration type.
ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress, bool SuppressConversion)
Definition Sema.h:3524
Helper class that creates diagnostics with optional template instantiation stacks.
Definition Sema.h:1558
const ImmediateDiagBuilder & operator<<(T &&V) const
Definition Sema.h:1608
ImmediateDiagBuilder(DiagnosticBuilder &&DB, Sema &SemaRef, unsigned DiagID)
Definition Sema.h:1565
friend const ImmediateDiagBuilder & operator<<(const ImmediateDiagBuilder &Diag, const T &Value)
Teach operator<< to produce an object of the correct type.
Definition Sema.h:1597
ImmediateDiagBuilder(const ImmediateDiagBuilder &)=default
ImmediateDiagBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
Definition Sema.h:1563
Helper class that collects exception specifications for implicitly-declared special member functions.
Definition Sema.h:5745
unsigned size() const
The number of exceptions in the exception specification.
Definition Sema.h:5778
ExceptionSpecificationType getExceptionSpecType() const
Get the computed exception specification type.
Definition Sema.h:5771
const QualType * data() const
The set of exceptions in the exception specification.
Definition Sema.h:5781
void CalledStmt(Stmt *S)
Integrate an invoked statement into the collected data.
void CalledExpr(Expr *E)
Integrate an invoked expression into the collected data.
Definition Sema.h:5787
void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method)
Integrate another called method into the collected data.
FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const
Overwrite an EPI's exception specification with this computed exception specification.
Definition Sema.h:5794
static NameClassification DependentNonType()
Definition Sema.h:2419
static NameClassification VarTemplate(TemplateName Name)
Definition Sema.h:2429
ExprResult getExpression() const
Definition Sema.h:2455
NameClassification(const IdentifierInfo *Keyword)
Definition Sema.h:2393
static NameClassification Unknown()
Definition Sema.h:2399
static NameClassification OverloadSet(ExprResult E)
Definition Sema.h:2403
NameClassificationKind getKind() const
Definition Sema.h:2453
static NameClassification UndeclaredTemplate(TemplateName Name)
Definition Sema.h:2447
static NameClassification FunctionTemplate(TemplateName Name)
Definition Sema.h:2435
NamedDecl * getNonTypeDecl() const
Definition Sema.h:2465
NameClassification(ParsedType Type)
Definition Sema.h:2391
TemplateName getTemplateName() const
Definition Sema.h:2470
ParsedType getType() const
Definition Sema.h:2460
TemplateNameKind getTemplateNameKind() const
Definition Sema.h:2477
static NameClassification NonType(NamedDecl *D)
Definition Sema.h:2409
static NameClassification Concept(TemplateName Name)
Definition Sema.h:2441
static NameClassification UndeclaredNonType()
Definition Sema.h:2415
static NameClassification TypeTemplate(TemplateName Name)
Definition Sema.h:2423
static NameClassification Error()
Definition Sema.h:2395
Custom deleter to allow FunctionScopeInfos to be kept alive for a short time after they've been poppe...
Definition Sema.h:1814
void operator()(sema::FunctionScopeInfo *Scope) const
Definition Sema.cpp:2025
PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct)
Definition SemaAttr.cpp:27
Whether and why a template name is required in this lookup.
Definition Sema.h:7332
RequiredTemplateKind(TemplateNameIsRequiredTag)
Template name is unconditionally required.
Definition Sema.h:7338
SourceLocation getTemplateKeywordLoc() const
Definition Sema.h:7340
RequiredTemplateKind(SourceLocation TemplateKWLoc=SourceLocation())
Template name is required if TemplateKWLoc is valid.
Definition Sema.h:7335
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Definition Sema.h:8986
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Definition Sema.h:9017
SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE=false)
Definition Sema.h:8994
A generic diagnostic builder for errors which may or may not be deferred.
Definition Sema.h:1629
void AddFixItHint(const FixItHint &Hint) const
Definition Sema.h:1699
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
Definition Sema.h:1668
SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID, FunctionDecl *Fn, Sema &S)
Definition Sema.cpp:1697
const SemaDiagnosticBuilder & operator<<(T &&V) const
Definition Sema.h:1682
friend StmtResult StmtError(const SemaDiagnosticBuilder &)
Definition Sema.h:1709
@ K_Nop
Emit no diagnostics.
Definition Sema.h:1633
@ K_Deferred
Create a deferred diagnostic, which is emitted only if the function it's attached to is codegen'ed.
Definition Sema.h:1643
@ K_ImmediateWithCallStack
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
Definition Sema.h:1639
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
Definition Sema.h:1635
friend ExprResult ExprError(const SemaDiagnosticBuilder &)
Definition Sema.h:1706
SemaDiagnosticBuilder(const SemaDiagnosticBuilder &)=default
A derivative of BoundTypeDiagnoser for which the diagnostic's type parameter is preceded by a 0/1 enu...
Definition Sema.h:2074
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition Sema.h:2079
SizelessTypeDiagnoser(unsigned DiagID, const Ts &... Args)
Definition Sema.h:2076
SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
Definition Sema.h:1345
SpecialMemberOverloadResult - The overloading result for a special member function.
Definition Sema.h:1318
SpecialMemberOverloadResult(CXXMethodDecl *MD)
Definition Sema.h:1331
CXXMethodDecl * getMethod() const
Definition Sema.h:1334
void setMethod(CXXMethodDecl *MD)
Definition Sema.h:1335
RAII object to handle the state changes required to synthesize a function body.
Definition Sema.h:1025
void addContextNote(SourceLocation UseLoc)
Definition Sema.h:1042
SynthesizedFunctionScope(Sema &S, DeclContext *DC)
Definition Sema.h:1031
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Definition Sema.h:9026
TentativeAnalysisScope(Sema &SemaRef)
Definition Sema.h:9032
Abstract base class used for diagnosing integer constant expression violations.
Definition Sema.h:11824
virtual SemaDiagnosticBuilder diagnoseNotICE(Sema &S, SourceLocation Loc)=0
virtual SemaDiagnosticBuilder diagnoseNotICEType(Sema &S, SourceLocation Loc, QualType T)
VerifyICEDiagnoser(bool Suppress=false)
Definition Sema.h:11828
virtual SemaDiagnosticBuilder diagnoseFold(Sema &S, SourceLocation Loc)
Sema - This implements semantic analysis and AST building for C.
Definition Sema.h:340
void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, RetainOwnershipKind K, bool IsTemplateInstantiation)
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType.
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={})
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
bool CheckInstantiatedFunctionTemplateConstraints(SourceLocation PointOfInstantiation, FunctionDecl *Decl, ArrayRef< TemplateArgument > TemplateArgs, ConstraintSatisfaction &Satisfaction)
QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
CXXConstructorDecl * DeclareImplicitDefaultConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit default constructor for the given class.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S)
MergeCXXFunctionDecl - Merge two declarations of the same C++ function, once we already know that the...
Attr * getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition)
Returns an implicit CodeSegAttr if a __declspec(code_seg) is found on a containing class.
QualType BuildParenType(QualType T)
Build a paren type including T.
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D)
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage)
Determine the result of a message send expression based on the type of the receiver,...
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
Definition Sema.h:3076
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, CXXScopeSpec &SS, TemplateIdAnnotation &TemplateId, const ParsedAttributesView &Attr, MultiTemplateParamsArg TemplateParameterLists, SkipBodyInfo *SkipBody=nullptr)
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Definition Sema.h:8671
bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function, const Expr *ThisArg, ArrayRef< const Expr * > Args, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any non-ArgDependent DiagnoseIf...
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
bool buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, MultiExprArg Args, SourceLocation RParenLoc, OverloadCandidateSet *CandidateSet, ExprResult *Result)
Constructs and populates an OverloadedCandidateSet from the given function.
llvm::SmallSetVector< CXXRecordDecl *, 16 > AssociatedClassSet
Definition Sema.h:3576
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition Sema.h:1419
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition Sema.h:9044
Decl * ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, MultiTemplateParamsArg TemplateParams, SourceLocation UsingLoc, UnqualifiedId &Name, const ParsedAttributesView &AttrList, TypeResult Type, Decl *DeclFromDeclSpec)
Scope * getCurScope() const
Retrieve the parser's current scope.
Definition Sema.h:12628
void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, LookupResult &OldDecls)
MergeTypedefNameDecl - We just parsed a typedef 'New' which has the same name and scope as a previous...
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
Definition SemaCUDA.cpp:108
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6....
void RegisterLocallyScopedExternCDecl(NamedDecl *ND, Scope *S)
Register the given locally-scoped extern "C" declaration so that it can be found later for redeclarat...
void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, SmallVectorImpl< CodeCompletionResult > &Results)
const ValueDecl * getOpenMPDeclareMapperVarName() const
NamedDecl * getCurFunctionOrMethodDecl()
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
Definition Sema.cpp:1355
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
OMPClause * ActOnOpenMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod)
The parsed has entered a submodule.
void CodeCompleteObjCProtocolDecl(Scope *S)
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation > > ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare reduction'.
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
void PopParsingClass(ParsingClassState state)
Definition Sema.h:4870
bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old)
void checkDeviceDecl(ValueDecl *D, SourceLocation Loc)
Check if the expression is allowed to be used in expressions for the offloading devices.
Definition Sema.cpp:1784
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr * > Uniforms, ArrayRef< Expr * > Aligneds, ArrayRef< Expr * > Alignments, ArrayRef< Expr * > Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr * > Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
void CodeCompleteTag(Scope *S, unsigned TagSpec)
void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor, SourceLocation Loc)
Adjust the calling convention of a method to be the ABI default if it wasn't specified explicitly.
bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID, const Ts &... Args)
Definition Sema.h:2263
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL)
void DiagnoseAbstractType(const CXXRecordDecl *RD)
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
OMPClause * ActOnOpenMPDestroyClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
ExprResult VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName, QualType FieldTy, bool IsMsStruct, Expr *BitWidth, bool *ZeroWidth=nullptr)
VerifyBitField - verifies that a bit field expression is an ICE and has the correct width,...
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method,...
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
Definition Sema.h:751
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
Definition Sema.cpp:823
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false)
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
llvm::SmallPtrSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
Definition Sema.h:1443
void ActOnParamUnparsedDefaultArgument(Decl *param, SourceLocation EqualLoc, SourceLocation ArgLoc)
ActOnParamUnparsedDefaultArgument - We've seen a default argument for a function parameter,...
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD)
Determine the kind of defaulting that would be done for a given function.
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared,...
llvm::DenseSet< Module * > & getLookupModules()
Get the set of additional modules that should be checked during name lookup.
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, tok::ObjCKeywordKind visibility)
ActOnIvar - Each ivar field of an objective-c class is passed into this in order to create an IvarDec...
void DiagnoseUnusedParameters(ArrayRef< ParmVarDecl * > Parameters)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Definition SemaAttr.cpp:902
Decl * ActOnParamDeclarator(Scope *S, Declarator &D)
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored,...
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old)
Merge the exception specifications of two variable declarations.
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool ErrorRecoveryLookup=false, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
TemplateDeductionResult SubstituteExplicitTemplateArguments(FunctionTemplateDecl *FunctionTemplate, TemplateArgumentListInfo &ExplicitTemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< QualType > &ParamTypes, QualType *FunctionType, sema::TemplateDeductionInfo &Info)
Substitute the explicitly-provided template arguments into the given function template according to C...
StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target teams' after parsing of the associated statement.
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)
Figure out if an expression could be turned into a call.
Definition Sema.cpp:2196
LookupNameKind
Describes the kind of name lookup to perform.
Definition Sema.h:3893
@ LookupLabel
Label name lookup.
Definition Sema.h:3902
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
Definition Sema.h:3897
@ LookupUsingDeclName
Look up all declarations in a scope with the given name, including resolved using declarations.
Definition Sema.h:3924
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
Definition Sema.h:3916
@ LookupOMPReductionName
Look up the name of an OpenMP user-defined reduction operation.
Definition Sema.h:3938
@ LookupLocalFriendName
Look up a friend of a local class.
Definition Sema.h:3932
@ LookupObjCProtocolName
Look up the name of an Objective-C protocol.
Definition Sema.h:3934
@ LookupRedeclarationWithLinkage
Look up an ordinary name that is going to be redeclared as a name with linkage.
Definition Sema.h:3929
@ LookupOperatorName
Look up of an operator name (e.g., operator+) for use with operator overloading.
Definition Sema.h:3909
@ LookupObjCImplicitSelfParam
Look up implicit 'self' parameter of an objective-c method.
Definition Sema.h:3936
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
Definition Sema.h:3920
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
Definition Sema.h:3905
@ LookupDestructorName
Look up a name following ~ in a destructor name.
Definition Sema.h:3912
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
Definition Sema.h:3900
@ LookupOMPMapperName
Look up the name of an OpenMP user-defined mapper.
Definition Sema.h:3940
@ LookupAnyName
Look up any declaration with any name.
Definition Sema.h:3942
void CodeCompleteUsing(Scope *S)
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function.
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
void ActOnPragmaAttributePop(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Called on well-formed '#pragma clang attribute pop'.
Definition SemaAttr.cpp:909
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
void ActOnPopScope(SourceLocation Loc, Scope *S)
Scope actions.
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
ExprResult ActOnConstantExpression(ExprResult Res)
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition SemaAttr.cpp:456
QualType CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
Decl * ActOnSkippedFunctionBody(Decl *Decl)
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:7293
@ VariadicDoesNotApply
Definition Sema.h:11256
@ VariadicFunction
Definition Sema.h:11252
@ VariadicMethod
Definition Sema.h:11254
@ VariadicConstructor
Definition Sema.h:11255
@ VariadicBlock
Definition Sema.h:11253
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< IdentifierInfo * > SelIdents)
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
void EvaluateImplicitExceptionSpec(SourceLocation Loc, FunctionDecl *FD)
Evaluate the implicit exception specification for a defaulted special member function.
OMPClause * ActOnOpenMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'write' clause.
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
OMPClause * ActOnOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, ArrayRef< unsigned > Arguments, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, ArrayRef< SourceLocation > ArgumentsLoc, SourceLocation DelimLoc, SourceLocation EndLoc)
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType)
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedOverridingExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
Definition Sema.h:875
ExplicitSpecifier ActOnExplicitBoolSpecifier(Expr *E)
ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression found in an explicit(bool)...
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
bool Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, TemplateArgumentListInfo &Result, const MultiLevelTemplateArgumentList &TemplateArgs)
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind)
Return the number of captured regions created for an OpenMP directive.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
void ActOnFinishCXXNonNestedClass()
ParsedType getConstructorName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, bool EnteringContext)
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, NamedDecl *PrevMemberDecl, AccessSpecifier LexicalAS)
SetMemberAccessSpecifier - Set the access specifier of a member.
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation.
llvm::SmallSetVector< NamedDecl *, 16 > NamedDeclSetType
Definition Sema.h:813
NonTrivialCUnionContext
Definition Sema.h:2699
@ NTCUC_CopyInit
Definition Sema.h:2709
@ NTCUC_AutoVar
Definition Sema.h:2707
@ NTCUC_CompoundLiteral
Definition Sema.h:2713
@ NTCUC_DefaultInitializedObject
Definition Sema.h:2705
@ NTCUC_Assignment
Definition Sema.h:2711
@ NTCUC_BlockCapture
Definition Sema.h:2715
@ NTCUC_FunctionReturn
Definition Sema.h:2703
@ NTCUC_LValueToRValueVolatile
Definition Sema.h:2717
@ NTCUC_FunctionParam
Definition Sema.h:2701
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack.
Definition Sema.h:740
ImplicitConversionSequence TryImplicitConversion(Expr *From, QualType ToType, bool SuppressUserConversions, AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, SmallVectorImpl< TemplateArgument > &Converted, bool &HasDefaultArg)
If the given template parameter has a default template argument, substitute into that default templat...
ExprResult BuildLiteralOperatorCall(LookupResult &R, DeclarationNameInfo &SuffixInfo, ArrayRef< Expr * > Args, SourceLocation LitEndLoc, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
BuildLiteralOperatorCall - Build a UserDefinedLiteral by creating a call to a literal operator descri...
void CodeCompleteCase(Scope *S)
void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind, uint64_t MagicValue, QualType Type, bool LayoutCompatible, bool MustBeNull)
Register a magic integral constant to be used as a type tag.
MissingImportKind
Kinds of missing import.
Definition Sema.h:2888
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_RValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
Definition Sema.cpp:563
StmtResult ActOnOpenMPScanDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp scan'.
llvm::SmallVector< DeleteExprLoc, 4 > DeleteLocs
Definition Sema.h:828
llvm::DenseSet< Module * > LookupModulesCache
Cache of additional modules that should be used for name lookup within the current template instantia...
Definition Sema.h:8687
StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, ParsedAttributes &Attrs, SourceLocation AttrEnd)
void ProcessDeclAttributeDelayed(Decl *D, const ParsedAttributesView &AttrList)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(TemplateParameterList *PParam, TemplateDecl *AArg, SourceLocation Loc)
ExprResult ActOnRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, ArrayRef< ParmVarDecl * > LocalParameters, ArrayRef< concepts::Requirement * > Requirements, SourceLocation ClosingBraceLoc)
OMPClause * ActOnOpenMPGrainsizeClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
void setOpenCLExtensionForDecl(Decl *FD, llvm::StringRef Exts)
Set OpenCL extensions for a declaration which can only be used when these OpenCL extensions are enabl...
Definition Sema.cpp:2462
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
bool isConstantEvaluated()
Definition Sema.h:1018
bool hasVisibleDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules)
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
ActOnTemplateParameterList - Builds a TemplateParameterList, optionally constrained by RequiresClause...
void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID)
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition Sema.cpp:1761
ExprResult BuildIvarRefExpr(Scope *S, SourceLocation Loc, ObjCIvarDecl *IV)
RetainOwnershipKind
Definition Sema.h:10067
bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg, SmallVectorImpl< TemplateArgument > &Converted)
void CodeCompleteObjCMessageReceiver(Scope *S)
void ActOnTagDefinitionError(Scope *S, Decl *TagDecl)
ActOnTagDefinitionError - Invoked when there was an unrecoverable error parsing the definition of a t...
void DiagnoseAlwaysNonNullPointer(Expr *E, Expr::NullPointerConstantKind NullType, bool IsEqual, SourceRange Range)
Diagnose pointers that are always non-null.
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed.
bool IsStringInit(Expr *Init, const ArrayType *AT)
Definition SemaInit.cpp:144
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition Sema.h:1156
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared move assignment operator.
void ActOnFinishDelayedMemberInitializers(Decl *Record)
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition Sema.h:1147
void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body)
bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class)
Perform qualified name lookup into all base classes of the given class.
std::function< void(const TypoCorrection &)> TypoDiagnosticGenerator
Definition Sema.h:4001
QualType BuildTypeofExprType(Expr *E, SourceLocation Loc)
void addImplicitTypedef(StringRef Name, QualType T)
Definition Sema.cpp:219
void PrintContextStack()
Definition Sema.h:8952
void DecomposeUnqualifiedId(const UnqualifiedId &Id, TemplateArgumentListInfo &Buffer, DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *&TemplateArgs)
Decomposes the given name into a DeclarationNameInfo, its location, and possibly a list of template a...
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
bool ActOnCoroutineBodyStart(Scope *S, SourceLocation KwLoc, StringRef Keyword)
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
bool InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
void ActOnOpenMPLoopInitialization(SourceLocation ForLoc, Stmt *Init)
Check if the current region is an OpenMP loop region and if it is, mark loop control variable,...
std::pair< StringRef, QualType > CapturedParamNameType
Definition Sema.h:4708
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=llvm::None)
Called on well-formed 'to' clause.
ExprResult BuildSourceLocExpr(SourceLocExpr::IdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
void ActOnOpenMPEndAssumesDirective()
Called on well-formed '#pragma omp end assumes'.
IfExistsResult
Describes the result of an "if-exists" condition check.
Definition Sema.h:5494
@ IER_DoesNotExist
The symbol does not exist.
Definition Sema.h:5499
@ IER_Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
Definition Sema.h:5503
@ IER_Error
An error occurred.
Definition Sema.h:5506
@ IER_Exists
The symbol exists.
Definition Sema.h:5496
void CheckDelegatingCtorCycles()
void ActOnStartStmtExpr()
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
NamedDecl * ActOnTemplateTemplateParameter(Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params, SourceLocation EllipsisLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg)
ActOnTemplateTemplateParameter - Called when a C++ template template parameter (e....
bool ActOnTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, Optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
CUDAFunctionPreference
Definition Sema.h:12008
@ CFP_HostDevice
Definition Sema.h:12013
@ CFP_SameSide
Definition Sema.h:12014
@ CFP_WrongSide
Definition Sema.h:12010
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
bool hasVisibleDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is visible.
Definition Sema.h:2160
bool FormatStringHasSArg(const StringLiteral *FExpr)
void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec)
Emit a warning for all pending noderef expressions that we recorded.
void ProcessPragmaWeak(Scope *S, Decl *D)
void ActOnStmtExprError()
bool IsLastErrorImmediate
Is the last error level diagnostic immediate.
Definition Sema.h:1733
StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope)
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
void CodeCompleteInitializer(Scope *S, Decl *D)
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition Sema.h:1159
bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info)
DiagnoseClassNameShadow - Implement C++ [class.mem]p13: If T is the name of a class,...
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
NoSpeculativeLoadHardeningAttr * mergeNoSpeculativeLoadHardeningAttr(Decl *D, const NoSpeculativeLoadHardeningAttr &AL)
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, ArithConvKind ACK)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6....
bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType, MultiExprArg Args, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage, SourceLocation lbrac, SourceLocation rbrac, SourceRange RecRange, QualType &ReturnType, ExprValueKind &VK)
CheckMessageArgumentTypes - Check types in an Obj-C message send.
static const IdentifierInfo * getPrintable(const IdentifierInfo *II)
Definition Sema.h:2023
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
StmtResult ActOnForEachLValueExpr(Expr *E)
In an Objective C collection iteration statement: for (x in y) x can be an arbitrary l-value expressi...
void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc, CXXRecordDecl *Record)
MarkBaseAndMemberDestructorsReferenced - Given a record decl, mark all the non-trivial destructors of...
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
Definition Sema.h:831
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, SourceRange BraceRange)
ActOnTagFinishDefinition - Invoked once we have finished parsing the definition of a tag (enumeration...
FunctionEmissionStatus
Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
Definition Sema.h:4106
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
Definition Sema.h:820
PragmaClangSection PragmaClangRodataSection
Definition Sema.h:462
DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D)
ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a C++ if/switch/while/for statem...
void CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE)
void LookupOverloadedBinOp(OverloadCandidateSet &CandidateSet, OverloadedOperatorKind Op, const UnresolvedSetImpl &Fns, ArrayRef< Expr * > Args, bool RequiresADL=true)
Perform lookup for an overloaded binary operator.
void NoteAllFoundTemplates(TemplateName Name)
bool hasVisibleDefinition(const NamedDecl *D)
Definition Sema.h:2178
ObjCContainerKind
Definition Sema.h:9405
@ OCK_Interface
Definition Sema.h:9407
@ OCK_ClassExtension
Definition Sema.h:9410
@ OCK_Category
Definition Sema.h:9409
@ OCK_Implementation
Definition Sema.h:9411
@ OCK_CategoryImplementation
Definition Sema.h:9412
@ OCK_Protocol
Definition Sema.h:9408
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
Definition Sema.h:869
concepts::Requirement * ActOnTypeRequirement(SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId)
void emitAndClearUnusedLocalTypedefWarnings()
Definition Sema.cpp:914
bool ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, SourceLocation ColonLoc, const ParsedAttributesView &Attrs)
ActOnAccessSpecifier - Parsed an access specifier followed by a colon.
NamedDecl * ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, Scope *S)
ImplicitlyDefineFunction - An undeclared identifier was used in a function call, forming a call to an...
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
std::unique_ptr< CXXFieldCollector > FieldCollector
FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
Definition Sema.h:811
StmtResult ActOnOpenMPOrderedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp ordered' after parsing of the associated statement.
void ActOnForEachDeclStmt(DeclGroupPtrTy Decl)
Definition SemaStmt.cpp:82
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
Definition Sema.h:1123
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
VarDecl * buildCoroutinePromise(SourceLocation Loc)
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
Definition SemaAttr.cpp:944
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
void addLambdaParameters(ArrayRef< LambdaIntroducer::LambdaCapture > Captures, CXXMethodDecl *CallOperator, Scope *CurScope)
Introduce the lambda parameters into scope.
bool isImplicitlyDeleted(FunctionDecl *FD)
Determine whether the given function is an implicitly-deleted special member function.
void CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD)
Check a completed declaration of an implicit special member.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
StmtResult ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancellation point'.
TemplateArgumentLoc getTemplateArgumentPackExpansionPattern(TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis, Optional< unsigned > &NumExpansions) const
Returns the pattern of the pack expansion for a template argument.
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition Sema.h:4505
PragmaClangSectionAction
Definition Sema.h:449
@ PCSA_Set
Definition Sema.h:450
@ PCSA_Clear
Definition Sema.h:451
void CodeCompleteObjCAtDirective(Scope *S)
bool IsAtLeastAsConstrained(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2, bool &Result)
Check whether the given declaration's associated constraints are at least as constrained than another...
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nowait' clause.
void InstantiateClassTemplateSpecializationMembers(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK)
Instantiate the definitions of all of the members of the given class template specialization,...
IdentifierInfo * getFloat128Identifier() const
Definition Sema.cpp:2423
bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const
void Initialize()
Perform initialization that occurs after the parser has been initialized but before it parses anythin...
Definition Sema.cpp:225
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
TranslationUnitKind TUKind
The kind of translation unit we are processing.
Definition Sema.h:1365
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc)
Adds the 'optnone' attribute to the function declaration if there are no conflicts; Loc represents th...
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Definition Sema.h:2219
OMPClause * ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, SourceLocation EndLoc)
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
static SourceRange getPrintable(SourceLocation L)
Definition Sema.h:2029
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
Definition Sema.h:840
void AddConversionCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
AddConversionCandidate - Add a C++ conversion function as a candidate in the candidate set (C++ [over...
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, const VarDecl *NRVOCandidate, QualType ResultType, Expr *Value, bool AllowNRVO=true)
Perform the initialization of a potentially-movable value, which is the result of return value.
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
Decl * ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
void CUDACheckLambdaCapture(CXXMethodDecl *D, const sema::Capture &Capture)
Definition SemaCUDA.cpp:762
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
@ Interface
'export module X;'
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
Definition Sema.h:773
void ActOnExitFunctionContext()
bool isOpenCLDisabledDecl(Decl *FD)
Definition Sema.cpp:2503
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
Definition Sema.h:11595
@ Ref_Incompatible
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible.
Definition Sema.h:11598
@ Ref_Compatible
Ref_Compatible - The two types are reference-compatible.
Definition Sema.h:11604
@ Ref_Related
Ref_Related - The two types are reference-related, which means that their unqualified forms (T1 and T...
Definition Sema.h:11602
StmtResult ActOnOpenMPDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for' after parsing of the associated statement...
bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD, const TemplateArgumentListInfo &ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given dependent function template specialization.
void RefersToMemberWithReducedAlignment(Expr *E, llvm::function_ref< void(Expr *, RecordDecl *, FieldDecl *, CharUnits)> Action)
This function calls Action when it determines that E designates a misaligned member due to the packed...
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Declarator &ParamInfo, Scope *CurScope)
ActOnStartOfLambdaDefinition - This is called just before we start parsing the body of a lambda; it a...
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType)
Definition Sema.h:7260
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result, Optional< unsigned > DependentDeductionDepth=None, bool IgnoreConstraints=false)
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
@ AR_dependent
Definition Sema.h:7202
@ AR_accessible
Definition Sema.h:7200
@ AR_inaccessible
Definition Sema.h:7201
@ AR_delayed
Definition Sema.h:7203
PoppedFunctionScopePtr PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, QualType BlockType=QualType())
Pop a function (or block or lambda or captured region) scope from the stack.
Definition Sema.cpp:2002
ClassTemplatePartialSpecializationDecl * getMoreSpecializedPartialSpecialization(ClassTemplatePartialSpecializationDecl *PS1, ClassTemplatePartialSpecializationDecl *PS2, SourceLocation Loc)
Returns the more specialized class template partial specialization according to the rules of partial ...
CompleteTypeKind
Definition Sema.h:2086
@ Normal
Apply the normal rules for complete types.
@ AcceptSizeless
Relax the normal rules for complete types so that they include sizeless built-in types.
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
Adds a conversion function template specialization candidate to the overload set, using template argu...
Preprocessor & getPreprocessor() const
Definition Sema.h:1524
OMPClause * ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'dynamic_allocators' clause.
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Definition Sema.cpp:1878
llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations
Specializations whose definitions are currently being instantiated.
Definition Sema.h:8674
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
Definition SemaCast.cpp:384
CXXConstructorDecl * DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit move constructor for the given class.
void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument)
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
void AddBuiltinCandidate(QualType *ParamTys, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool IsAssignmentOperator=false, unsigned NumContextualBoolArguments=0)
AddBuiltinCandidate - Add a candidate for a built-in operator.
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, FunctionDeclAndLoc > DeviceKnownEmittedFns
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus th...
Definition Sema.h:11908
void deduceOpenCLAddressSpace(ValueDecl *decl)
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
PragmaStack< FPOptionsOverride > FpPragmaStack
Definition Sema.h:685
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
DefaultedComparisonKind getDefaultedComparisonKind(const FunctionDecl *FD)
Definition Sema.h:3079
void EraseUnwantedCUDAMatches(const FunctionDecl *Caller, SmallVectorImpl< std::pair< DeclAccessPair, FunctionDecl * > > &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
Definition SemaCUDA.cpp:230
static SourceRange getPrintable(const Expr *E)
Definition Sema.h:2030
PragmaStack< StringLiteral * > CodeSegStack
Definition Sema.h:682
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Scope *CurScope)
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
Definition SemaAttr.cpp:993
void referenceDLLExportedClassMethods()
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList &TemplateArgList, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
llvm::DenseMap< IdentifierInfo *, SrcLocSet > IdentifierSourceLocations
Definition Sema.h:9054
void CheckCompleteDestructorVariant(SourceLocation CurrentLocation, CXXDestructorDecl *Dtor)
Do semantic checks to allow the complete destructor variant to be emitted when the destructor is defi...
NamedDecl * ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BitfieldWidth, const VirtSpecifiers &VS, InClassInitStyle InitStyle)
ActOnCXXMemberDeclarator - This is invoked when a C++ class member declarator is parsed.
bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckForFunctionMarkedFinal - Checks whether a virtual member function overrides a virtual member fun...
static NamedDecl * getAsTemplateNameDecl(NamedDecl *D, bool AllowFunctionTemplates=true, bool AllowDependent=true)
Try to interpret the lookup result D as a template-name.
void AddArgumentDependentLookupCandidates(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, TemplateArgumentListInfo *ExplicitTemplateArgs, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add function candidates found via argument-dependent lookup to the set of overloading candidates.
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
QualType CheckGNUVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
void setFunctionHasBranchIntoScope()
Definition Sema.cpp:2050
bool CheckForConstantInitializer(Expr *e, QualType t)
type checking declaration initializers (C99 6.7.8)
ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
Definition SemaCUDA.cpp:42
WebAssemblyImportNameAttr * mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL)
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
StmtResult ActOnOpenMPTargetSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target simd' after parsing of the associated statement.
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
Definition Sema.h:808
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
Definition SemaStmt.cpp:440
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
StmtResult ActOnOpenMPForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for' after parsing of the associated statement.
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimizeoff". If this location is invalid,...
Definition Sema.h:10017
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition SemaAttr.cpp:448
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsMemberSpecialization, bool &Invalid, bool SuppressDiagnostic=false)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
void CodeCompleteObjCAtExpression(Scope *S)
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
SmallVector< AlignPackIncludeState, 8 > AlignPackIncludeStack
Definition Sema.h:677
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl)
AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared special functions,...
bool tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec)
tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool ExplicitResultType, bool Mutable)
Endow the lambda scope info with the relevant properties.
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
Definition SemaAttr.cpp:50
Decl * ActOnConversionDeclarator(CXXConversionDecl *Conversion)
ActOnConversionDeclarator - Called by ActOnDeclarator to complete the declaration of the given C++ co...
void CheckMain(FunctionDecl *FD, const DeclSpec &D)
void setCurrentOpenCLExtensionForDecl(Decl *FD)
Set current OpenCL extensions for a declaration which can only be used when these OpenCL extensions a...
Definition Sema.cpp:2477
OMPClause * ActOnOpenMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'simd' clause.
void AddKnownFunctionAttributes(FunctionDecl *FD)
Adds any function attributes that we know a priori based on the declaration of this function.
ExprResult SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs, bool CXXDirectInit)
ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool IsUnevaluatedContext)
llvm::MapVector< IdentifierInfo *, WeakInfo > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Definition Sema.h:1067
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
llvm::SmallSetVector< DeclContext *, 16 > AssociatedNamespaceSet
Definition Sema.h:3575
void ActOnComment(SourceRange Comment)
Definition Sema.cpp:2142
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, ArrayRef< QualType > ArgTys, bool AllowRaw, bool AllowTemplate, bool AllowStringTemplate, bool DiagnoseMissing, StringLiteral *StringLit=nullptr)
LookupLiteralOperator - Determine which literal operator should be used for a user-defined literal,...
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, IdentifierInfo *PropertyName)
bool RequireStructuralType(QualType T, SourceLocation Loc)
Require the given type to be a structural type, and diagnose if it is not.
concepts::Requirement * ActOnSimpleRequirement(Expr *E)
OMPClause * ActOnOpenMPMapClause(ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=llvm::None)
Called on well-formed 'map' clause.
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition Sema.h:4305
EnforceTCBAttr * mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL)
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue=true)
Definition SemaStmt.cpp:45
FieldDecl * HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS)
HandleField - Analyze a field of a C struct or a C++ data member.
OpaquePtr< TemplateName > TemplateTy
Definition Sema.h:391
void ActOnEndOfTranslationUnit()
ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...
Definition Sema.cpp:1010
llvm::DenseMap< NamedDecl *, NamedDecl * > VisibleNamespaceCache
Map from the most recent declaration of a namespace to the most recent visible declaration of that na...
Definition Sema.h:8696
StmtResult ActOnOpenMPTargetParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for' after parsing of the associated statement.
FPOptionsOverride CurFPFeatureOverrides()
Definition Sema.h:686
ExprResult ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType, SourceLocation StartLoc, DeclarationName VN)
Build the mapper variable of '#pragma omp declare mapper'.
void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD)
Diagnose methods which overload virtual methods in a base class without overriding any.
bool isValidSveBitcast(QualType srcType, QualType destType)
Are the two types SVE-bitcast-compatible types? I.e.
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, const TemplateArgumentListInfo *TemplateArgs)
ActOnDependentIdExpression - Handle a dependent id-expression that was just parsed.
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition Sema.h:1132
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, bool AfterAmpersand)
QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope.
FieldDecl * BuildCaptureField(RecordDecl *RD, const sema::Capture &Capture)
Build a FieldDecl suitable to hold the given capture.
TypeResult ActOnOpenMPDeclareMapperVarDecl(Scope *S, Declarator &D)
Check variable declaration in 'omp declare mapper' construct.
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
concepts::Requirement * ActOnCompoundRequirement(Expr *E, SourceLocation NoexceptLoc)
void ActOnPragmaMSSeg(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, StringLiteral *SegmentName, llvm::StringRef PragmaName)
Called on well formed #pragma bss_seg/data_seg/const_seg/code_seg.
Definition SemaAttr.cpp:649
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
bool hasVisibleExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is an explicit specialization declaration for a...
TypeResult ActOnTypeName(Scope *S, Declarator &D)
bool IsInsideALocalClassWithinATemplateFunction()
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
void setCurrentOpenCLExtension(llvm::StringRef Ext)
Definition Sema.h:10137
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
StmtResult ActOnOpenMPDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for simd' after parsing of the associated stat...
Decl * ActOnTemplateDeclarator(Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D)
void ActOnTranslationUnitScope(Scope *S)
Definition Sema.cpp:90
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
void ActOnReenterFunctionContext(Scope *S, Decl *D)
Push the parameters of D, which must be a function, into scope.
llvm::DenseMap< Decl *, SmallVector< PartialDiagnosticAt, 1 > > SuppressedDiagnosticsMap
For each declaration that involved template argument deduction, the set of diagnostics that were supp...
Definition Sema.h:8765
CXXRecordDecl * createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, bool KnownDependent, LambdaCaptureDefault CaptureDefault)
Create a new lambda closure type.
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
DeclGroupPtrTy ActOnOpenMPRequiresDirective(SourceLocation Loc, ArrayRef< OMPClause * > ClauseList)
Called on well-formed '#pragma omp requires'.
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType, SourceLocation Loc, const PartialDiagnostic &Diag)
Is the given member accessible for the purposes of deciding whether to define a special member functi...
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, unsigned &Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
Called by ActOnProperty to handle @property declarations in class extensions.
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type.
Definition SemaDecl.cpp:284
IdentifierInfo * getSuperIdentifier() const
Definition Sema.cpp:2417
void startOpenMPLoop()
If the current region is a loop-based region, mark the start of the loop construct.
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action, PragmaFloatControlKind Value)
ActOnPragmaFloatControl - Call on well-formed #pragma float_control.
Definition SemaAttr.cpp:464
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6....
Definition SemaExpr.cpp:766
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
Decl * getObjCDeclContext() const
LateParsedTemplateMapT LateParsedTemplateMap
Definition Sema.h:888
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
Definition Sema.h:7658
@ CTAK_DeducedFromArrayBound
The template argument was deduced from an array bound via template argument deduction.
Definition Sema.h:7669
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
Definition Sema.h:7661
@ CTAK_Deduced
The template argument was deduced via template argument deduction.
Definition Sema.h:7665
bool SubstExprs(ArrayRef< Expr * > Exprs, bool IsCall, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< Expr * > &Outputs)
Substitute the given template arguments into a list of expressions, expanding pack expansions if requ...
TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S)
isTagName() - This method is called for error recovery purposes only to determine if the specified na...
Definition SemaDecl.cpp:609
void ActOnFinishFunctionDeclarationDeclarator(Declarator &D)
Called after parsing a function declarator belonging to a function declaration.
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition SemaAttr.cpp:517
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, QualType PreferredType)
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
ExprResult CheckUnevaluatedOperand(Expr *E)
llvm::DenseMap< const EnumDecl *, llvm::APInt > FlagBitsCache
A cache of the flags available in enumerations with the flag_bits attribute.
Definition Sema.h:1356
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
Definition Sema.h:9048
void CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass &SC)
CheckConversionDeclarator - Called by ActOnDeclarator to check the well-formednes of the conversion f...
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
Definition SemaExpr.cpp:964
void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc)
CXXMethodDecl * startLambdaDefinition(CXXRecordDecl *Class, SourceRange IntroducerRange, TypeSourceInfo *MethodType, SourceLocation EndLoc, ArrayRef< ParmVarDecl * > Params, ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause)
Start the definition of a lambda expression.
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization, bool Disambiguation=false)
ExprResult tryConvertExprToType(Expr *E, QualType Ty)
Try to convert an expression E to type Ty.
Decl * ActOnFileScopeAsmDecl(Expr *expr, SourceLocation AsmLoc, SourceLocation RParenLoc)
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
bool IsAllowedCUDACall(const FunctionDecl *Caller, const FunctionDecl *Callee)
Determines whether Caller may invoke Callee, based on their CUDA host/device attributes.
Definition Sema.h:12034
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
ParsedTemplateArgument ActOnTemplateTypeArgument(TypeResult ParsedType)
Convert a parsed type into a parsed template argument.
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
Definition SemaStmt.cpp:708
bool DiagnoseUnknownTemplateName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, const CXXScopeSpec *SS, TemplateTy &SuggestedTemplate, TemplateNameKind &SuggestedKind)
Decl * ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc, IdentifierInfo *AliasName, SourceLocation AliasLocation, IdentifierInfo *ClassName, SourceLocation ClassLocation)
ActOnCompatibilityAlias - this action is called after complete parsing of a @compatibility_alias decl...
ASTContext & Context
Definition Sema.h:399
StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target exit data' after parsing of the associated statement.
static bool TooManyArguments(size_t NumParams, size_t NumArgs, bool PartialOverloading=false)
To be used for checking whether the arguments being passed to function exceeds the number of paramete...
Definition Sema.h:12660
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one.
Definition Sema.cpp:513
QualType InvalidOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
the following "Check" methods will return a valid/converted QualType or a null QualType (indicating a...
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E)
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, TemplateDecl *PrimaryTemplate, unsigned NumExplicitArgs, ArrayRef< TemplateArgument > Args)
Check the non-type template arguments of a class template partial specialization according to C++ [te...
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
void ActOnCapturedRegionError()
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
ARCConversionResult
Definition Sema.h:11666
@ ACR_unbridged
Definition Sema.h:11666
StmtResult ActOnOpenMPFlushDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp flush'.
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
IdentifierSourceLocations TypoCorrectionFailures
A cache containing identifiers for which typo correction failed and their locations,...
Definition Sema.h:9059
FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC)
Definition Sema.h:4561
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
Definition SemaAttr.cpp:690
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
bool InNonInstantiationSFINAEContext
Whether we are in a SFINAE context that is not associated with template instantiation.
Definition Sema.h:8703
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
void ActOnLambdaExplicitTemplateParameterList(SourceLocation LAngleLoc, ArrayRef< NamedDecl * > TParams, SourceLocation RAngleLoc, ExprResult RequiresClause)
This is called after parsing the explicit template parameter list on a lambda (if it exists) in C++2a...
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, const Scope *S, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
DiagnosticsEngine & getDiagnostics() const
Definition Sema.h:1522
static FormatStringType GetFormatStringType(const FormatAttr *Format)
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, UsingDecl *UD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function, bool Complain=false, SourceLocation Loc=SourceLocation())
Returns whether the given function's address can be taken or not, optionally emitting a diagnostic if...
std::string getOpenCLExtensionsFromExtMap(T *FT, MapT &Map)
Find an extension in an appropriate extension map and return its name.
Definition Sema.cpp:2498
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnCXXThis(SourceLocation loc)
bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2274
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
bool CheckCaseExpression(Expr *E)
VisibilityAttr * mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, VisibilityAttr::VisibilityType Vis)
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
isObjCPointerConversion - Determines whether this is an Objective-C pointer conversion.
void CodeCompleteAfterIf(Scope *S, bool IsBracedThen)
static bool getPrintable(bool B)
Definition Sema.h:2019
bool LookupBuiltin(LookupResult &R)
Lookup a builtin function, when name lookup would otherwise fail.
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
void propagateDLLAttrToBaseClassTemplate(CXXRecordDecl *Class, Attr *ClassAttr, ClassTemplateSpecializationDecl *BaseTemplateSpec, SourceLocation BaseLoc)
Perform propagation of DLL attributes from a derived class to a templated base class for MS compatibi...
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, TypedefNameDecl *NewTD)
QualType CheckMatrixElementwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Type checking for matrix binary operators.
bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, bool ForceComplain=false, bool(*IsPlausibleResult)(QualType)=nullptr)
Try to recover by turning the given expression into a call.
Definition Sema.cpp:2376
OMPClause * ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument, SourceLocation ArgumentLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
OMPClause * ActOnOpenMPDependClause(Expr *DepModifier, OpenMPDependClauseKind DepKind, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over....
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp)
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
DeclGroupPtrTy ActOnOpenMPThreadprivateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList)
Called on well-formed '#pragma omp threadprivate'.
void CheckDelayedMemberExceptionSpecs()
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
Definition SemaDecl.cpp:56
void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param)
This is used to implement the constant expression evaluation part of the attribute enable_if extensio...
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
bool checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType T)
Check if type T corresponding to declaration specifier DS is disabled due to required OpenCL extensio...
Definition Sema.cpp:2533
ClassTemplateDecl * StdCoroutineTraitsCache
The C++ "std::coroutine_traits" template, which is defined in <coroutine_traits>
Definition Sema.h:1114
ExprResult ActOnSourceLocExpr(SourceLocExpr::IdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc)
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, UnresolvedSetImpl &Functions)
BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, ParsedAttributes &Attrs, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used.
Definition Sema.h:861
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition Sema.h:1141
bool hasVisibleDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a visible default argument.
void CleanupVarDeclMarking()
void CodeCompleteAvailabilityPlatformName()
bool CheckConstraintExpression(const Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
Definition SemaExpr.cpp:732
NamedDecl * LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S, bool ForRedeclaration, SourceLocation Loc)
LazilyCreateBuiltin - The specified Builtin-ID was first used at file scope.
ASTContext & getASTContext() const
Definition Sema.h:1525
std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr
Definition Sema.h:1822
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
Definition SemaExpr.cpp:744
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, ArrayRef< QualType > Params)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller, const FunctionDecl *Callee, SourceLocation Loc)
Finishes analysis of the deferred functions calls that may be declared as host/nohost during device/h...
ExprResult VerifyIntegerConstantExpression(Expr *E, AllowFoldKind CanFold=NoFold)
Definition Sema.h:11855
StmtResult ActOnOpenMPDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute simd' after parsing of the associated statement.
UnresolvedSetIterator getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd, TemplateSpecCandidateSet &FailedCandidates, SourceLocation Loc, const PartialDiagnostic &NoneDiag, const PartialDiagnostic &AmbigDiag, const PartialDiagnostic &CandidateDiag, bool Complain=true, QualType TargetType=QualType())
Retrieve the most specialized of the given function template specializations.
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
IsIntegralPromotion - Determines whether the conversion from the expression From (whose potentially-a...
bool DiagnoseUnexpandedParameterPackInRequiresExpr(RequiresExpr *RE)
If the given requirees-expression contains an unexpanded reference to one of its own parameter packs,...
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
bool IsFloatingPointPromotion(QualType FromType, QualType ToType)
IsFloatingPointPromotion - Determines whether the conversion from FromType to ToType is a floating po...
bool checkMSInheritanceAttrOnDefinition(CXXRecordDecl *RD, SourceRange Range, bool BestCase, MSInheritanceModel SemanticSpelling)
SwiftNameAttr * mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA, StringRef Name)
QualType BuildDecltypeType(Expr *E, SourceLocation Loc, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>.
Definition Sema.h:1110
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
void CheckExplicitlyDefaultedFunction(Scope *S, FunctionDecl *MD)
StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target update'.
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition Sema.h:4860
StmtResult ActOnOpenMPSingleDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp single' after parsing of the associated statement.
void CodeCompleteObjCPropertyDefinition(Scope *S)
void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
Definition SemaAttr.cpp:790
bool isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS=nullptr)
isCurrentClassName - Determine whether the identifier II is the name of the class type currently bein...
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for simd' after parsing of the as...
void MarkVariableReferenced(SourceLocation Loc, VarDecl *Var)
Mark a variable referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
llvm::SetVector< Expr *, SmallVector< Expr *, 4 >, llvm::SmallPtrSet< Expr *, 4 > > MaybeODRUseExprSet
Store a set of either DeclRefExprs or MemberExprs that contain a reference to a variable (constant) t...
Definition Sema.h:765
Decl * ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc, SourceLocation LBraceLoc)
We have parsed the start of an export declaration, including the '{' (if present).
void checkExceptionSpecification(bool IsTopLevel, ExceptionSpecificationType EST, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr, SmallVectorImpl< QualType > &Exceptions, FunctionProtoType::ExceptionSpecInfo &ESI)
Check the given exception-specification and update the exception specification information with the r...
OMPClause * ActOnOpenMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'capture' clause.
void LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, UnresolvedSetImpl &Functions)
NameClassificationKind
Describes the result of the name lookup and resolution performed by ClassifyName().
Definition Sema.h:2340
@ NC_Unknown
This name is not a type or template in this context, but might be something else.
Definition Sema.h:2343
@ NC_VarTemplate
The name was classified as a variable template name.
Definition Sema.h:2370
@ NC_NonType
The name was classified as a specific non-type, non-template declaration.
Definition Sema.h:2353
@ NC_TypeTemplate
The name was classified as a template whose specializations are types.
Definition Sema.h:2368
@ NC_Error
Classification failed; an error has been produced.
Definition Sema.h:2345
@ NC_FunctionTemplate
The name was classified as a function template name.
Definition Sema.h:2372
@ NC_DependentNonType
The name denotes a member of a dependent type that could not be resolved.
Definition Sema.h:2361
@ NC_UndeclaredNonType
The name was classified as an ADL-only function name.
Definition Sema.h:2357
@ NC_UndeclaredTemplate
The name was classified as an ADL-only function template name.
Definition Sema.h:2374
@ NC_Keyword
The name has been typo-corrected to a keyword.
Definition Sema.h:2347
@ NC_Type
The name was classified as a type.
Definition Sema.h:2349
@ NC_OverloadSet
The name was classified as an overload set, and an expression representing that overload set has been...
Definition Sema.h:2366
@ NC_Concept
The name was classified as a concept name.
Definition Sema.h:2376
bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method)
Check whether 'this' shows up in the type of a static member function after the (naturally empty) cv-...
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
void DiagnoseUnguardedAvailabilityViolations(Decl *FD)
Issue any -Wunguarded-availability warnings in FD.
void PopExpressionEvaluationContext()
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace.
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
PragmaStack< StringLiteral * > ConstSegStack
Definition Sema.h:681
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
Definition SemaAttr.cpp:215
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
Definition SemaExpr.cpp:815
bool isInitListConstructor(const FunctionDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init....
void ActOnStartFunctionDeclarationDeclarator(Declarator &D, unsigned TemplateParameterDepth)
Called before parsing a function declarator belonging to a function declaration.
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S)
isMicrosoftMissingTypename - In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal...
Definition SemaDecl.cpp:642
bool isConstantEvaluatedOverride
Used to change context to isConstantEvaluated without pushing a heavy ExpressionEvaluationContextReco...
Definition Sema.h:1016
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef< OMPClause * > Clauses)
End of OpenMP region.
bool ActOnStartOpenMPDeclareTargetDirective(SourceLocation Loc)
Called on the start of target region i.e. '#pragma omp declare target'.
std::string getOpenCLExtensionsFromTypeExtMap(FunctionType *FT)
Check if a function type FT associates with any extensions present in OpenCLTypeExtMap and if so retu...
Definition Sema.cpp:2490
ParsingClassState PushParsingClass()
Definition Sema.h:4866
SmallVector< VarDecl *, 4 > ExternalDeclarations
All the external declarations encoutered and used in the TU.
Definition Sema.h:853
bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall)
Check whether the given method, which must be in the 'init' family, is a valid member of that family.
@ FRS_Success
Definition Sema.h:3781
@ FRS_DiagnosticIssued
Definition Sema.h:3783
@ FRS_NoViableFunction
Definition Sema.h:3782
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
void ActOnPragmaFPExceptions(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called on well formed '#pragma clang fp' that has option 'exceptions'.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
Definition SemaAttr.cpp:108
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, bool AllowRecovery=false)
BuildCallToMemberFunction - Build a call to a member function.
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
void CodeCompleteUsingDirective(Scope *S)
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
unsigned TyposCorrected
The number of typos corrected by CorrectTypo.
Definition Sema.h:9051
SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target parallel' after parsing of the associated statement.
bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn)
We've just determined that Old and New both appear to be definitions of the same variable.
DefaultedComparisonKind
Kinds of defaulted comparison operator functions.
Definition Sema.h:1446
@ Relational
This is an <, <=, >, or >= that should be implemented as a rewrite in terms of a <=> comparison.
@ NotEqual
This is an operator!= that should be implemented as a rewrite in terms of a == comparison.
@ ThreeWay
This is an operator<=> that should be implemented as a series of subobject comparisons.
@ None
This is not a defaultable comparison operator.
@ Equal
This is an operator== that should be implemented as a series of subobject comparisons.
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary type trait support pseudo-functions.
QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType)
llvm::SmallVector< QualType, 4 > CurrentParameterCopyTypes
Stack of types that correspond to the parameter entities that are currently being copy-initialized.
Definition Sema.h:1471
bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType, bool &IncompatibleObjC)
IsPointerConversion - Determines whether the conversion of the expression From, which has the (possib...
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
AllowedExplicit
Definition Sema.h:3368
@ Conversions
Allow explicit conversion functions but not explicit constructors.
@ All
Allow both explicit conversion functions and explicit constructors.
void ActOnFinishRequiresExpr()
void MatchAllMethodDeclarations(const SelectorSet &InsMap, const SelectorSet &ClsMap, SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass, bool WarnCategoryMethodImpl=false)
MatchAllMethodDeclarations - Check methods declaraed in interface or or protocol against those declar...
bool checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
Definition SemaSYCL.cpp:35
static const unsigned MaxAlignmentExponent
The maximum alignment, same as in llvm::Value.
Definition Sema.h:387
QualType CheckMatrixMultiplyOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
void CheckObjCMethodDirectOverrides(ObjCMethodDecl *method, ObjCMethodDecl *overridden)
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
void * SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS)
Given a C++ nested-name-specifier, produce an annotation value that the parser can use later to recon...
std::string getOpenCLExtensionsFromDeclExtMap(FunctionDecl *FD)
Check if a function declaration FD associates with any extensions present in OpenCLDeclExtMap and if ...
Definition Sema.cpp:2483
llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > LateParsedTemplateMapT
Definition Sema.h:887
bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee)
void CodeCompleteTypeQualifiers(DeclSpec &DS)
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
Definition Sema.h:2915
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
bool IsComplexPromotion(QualType FromType, QualType ToType)
Determine if a conversion is a complex promotion.
void redelayDiagnostics(sema::DelayedDiagnosticPool &pool)
Decl * BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, AccessSpecifier AS, RecordDecl *Record, const PrintingPolicy &Policy)
BuildAnonymousStructOrUnion - Handle the declaration of an anonymous structure or union.
bool isCopyElisionCandidate(QualType ReturnType, const VarDecl *VD, CopyElisionSemanticsKind CESK)
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified global variable must be captured by outer capture regions.
Module * getOwningModule(const Decl *Entity)
Get the module owning an entity.
Definition Sema.h:2137
bool SubstTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentListInfo &Outputs)
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
Definition Sema.cpp:1348
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
ActOnCXXThrow - Parse throw expressions.
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
Definition Sema.cpp:2133
unsigned InventedParameterInfosStart
The index of the first InventedParameterInfo that refers to the current context.
Definition Sema.h:793
void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, SmallVectorImpl< TemplateArgument > &Converted, CheckTemplateArgumentKind CTAK=CTAK_Specified)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnOpenMPParallelMasterDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel master' after parsing of the associated statement.
DeclContext * getFunctionLevelDeclContext()
Definition Sema.cpp:1322
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
Definition Sema.h:1370
void CodeCompleteObjCMethodDecl(Scope *S, Optional< bool > IsInstanceMethod, ParsedType ReturnType)
void setFunctionHasIndirectGoto()
Definition Sema.cpp:2060
void HandleDependentAccessCheck(const DependentDiagnostic &DD, const MultiLevelTemplateArgumentList &TemplateArgs)
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
Definition Sema.h:7742
@ TPL_TemplateTemplateParmMatch
We are matching the template parameter lists of two template template parameters as part of matching ...
Definition Sema.h:7760
@ TPL_TemplateTemplateArgumentMatch
We are matching the template parameter lists of a template template argument against the template par...
Definition Sema.h:7771
@ TPL_TemplateMatch
We are matching the template parameter lists of two templates that might be redeclarations.
Definition Sema.h:7750
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
NamedDecl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg, bool HasTypeConstraint)
ActOnTypeParameter - Called when a C++ template type parameter (e.g., "typename T") has been parsed.
StmtResult ActOnOpenMPTargetDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target' after parsing of the associated statement.
ExprResult PerformObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
PerformObjectArgumentInitialization - Perform initialization of the implicit object parameter for the...
AvailabilityAttr * mergeAvailabilityAttr(NamedDecl *D, const AttributeCommonInfo &CI, IdentifierInfo *Platform, bool Implicit, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, bool IsStrict, StringRef Replacement, AvailabilityMergeKind AMK, int Priority)
Attribute merging methods. Return true if a new attribute was added.
SmallVectorImpl< Decl * > & WeakTopLevelDecls()
WeakTopLevelDeclDecls - access to #pragma weak-generated Decls.
Definition Sema.h:1869
EnumDecl * getStdAlignValT() const
void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
StmtResult ActOnOpenMPCancelDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancel'.
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
Definition Sema.cpp:1362
ExprResult BuildCaptureInit(const sema::Capture &Capture, SourceLocation ImplicitCaptureLoc, bool IsOpenMPMapping=false)
Initialize the given capture with a suitable expression.
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
Definition Sema.h:1098
CommonAttr * mergeCommonAttr(Decl *D, const ParsedAttr &AL)
void checkUnusedDeclAttributes(Declarator &D)
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration.
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
Definition SemaAttr.cpp:272
bool IsBlockPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
OMPClause * ActOnOpenMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'untied' clause.
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous, bool QualifiedFriend=false)
Perform semantic analysis for the given function template specialization.
void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc, ArrayRef< Expr * > Args, AssociatedNamespaceSet &AssociatedNamespaces, AssociatedClassSet &AssociatedClasses)
Find the associated classes and namespaces for argument-dependent lookup for a call with the given se...
AssumedTemplateKind
Definition Sema.h:7351
@ FoundFunctions
This is assumed to be a template name because lookup found one or more functions (but no function tem...
@ FoundNothing
This is assumed to be a template name because lookup found nothing.
void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, OverloadCandidateParamOrder PO={})
Add a C++ member function template as a candidate to the candidate set, using template argument deduc...
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
Definition SemaAttr.cpp:595
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI ABI)
void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld)
MergeVarDeclTypes - We parsed a variable 'New' which has the same name and scope as a previous declar...
llvm::DenseMap< IdentifierInfo *, AsmLabelAttr * > ExtnameUndeclaredIdentifiers
ExtnameUndeclaredIdentifiers - Identifiers contained in #pragma redefine_extname before declared.
Definition Sema.h:1073
void CodeCompleteInPreprocessorConditionalExclusion(Scope *S)
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition Sema.h:1135
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation OpLoc)
Warn if a value is moved to itself.
ExprResult ActOnOpenMPIdExpression(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id, OpenMPDirectiveKind Kind)
Called on correct id-expression from the '#pragma omp threadprivate'.
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for.
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true)
OMPClause * ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, const AttributeCommonInfo &CI)
void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, SourceLocation IdLoc=SourceLocation())
Check declaration inside target region.
OMPClause * ActOnOpenMPUpdateClause(OpenMPDependClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'update' clause.
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
Definition SemaStmt.cpp:896
AtomicArgumentOrder
Definition Sema.h:5355
void PushFunctionScope()
Enter a new function scope.
Definition Sema.cpp:1897
ExprResult ActOnNameClassifiedAsNonType(Scope *S, const CXXScopeSpec &SS, NamedDecl *Found, SourceLocation NameLoc, const Token &NextToken)
Act on the result of classifying a name as a specific non-type declaration.
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
ExprResult ActOnBuiltinBitCastExpr(SourceLocation KWLoc, Declarator &Dcl, ExprResult Operand, SourceLocation RParenLoc)
Definition SemaCast.cpp:372
void EmitCurrentDiagnostic(unsigned DiagID)
Cause the active diagnostic on the DiagosticsEngine to be emitted.
Definition Sema.cpp:1368
SourceRange getExprRange(Expr *E) const
Definition SemaExpr.cpp:494
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
void CheckDeductionGuideDeclarator(Declarator &D, QualType &R, StorageClass &SC)
Check the validity of a declarator that we parsed for a deduction-guide.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
void setExceptionMode(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called to set exception behavior for floating point operations.
void PrintPragmaAttributeInstantiationPoint()
Definition SemaAttr.cpp:974
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
ArrayRef< InventedTemplateParameterInfo > getInventedParameterInfos() const
Definition Sema.h:795
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
Definition SemaAttr.cpp:164
Decl * ActOnObjCContainerStartDefinition(Decl *IDecl)
void tryCaptureOpenMPLambdas(ValueDecl *V)
Function tries to capture lambda's captured variables in the OpenMP region before the original lambda...
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
CheckMemberPointerConversion - Check the member pointer conversion from the expression From to the ty...
void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitCopyConstructor - Checks for feasibility of defining this constructor as the copy const...
void LateTemplateParserCleanupCB(void *P)
Definition Sema.h:892
static DeclarationName getPrintable(DeclarationName N)
Definition Sema.h:2026
StmtResult ActOnOpenMPDepobjDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp depobj'.
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
FPOptions & getCurFPFeatures()
Definition Sema.h:1520
void SetLateTemplateParser(LateTemplateParserCB *LTP, LateTemplateParserCleanupCB *LTPCleanup, void *P)
Definition Sema.h:897
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition Sema.cpp:52
sema::LambdaScopeInfo * PushLambdaScope()
Definition Sema.cpp:1914
StmtResult ActOnCoreturnStmt(Scope *S, SourceLocation KwLoc, Expr *E)
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
void PopCompoundScope()
Definition Sema.cpp:2037
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2228
bool isObjCMethodDecl(Decl *D)
Definition Sema.h:2776
void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext, bool IsUsingDeclaration, QualType BaseType, QualType PreferredType)
UnexpandedParameterPackContext
The context in which an unexpanded parameter pack is being diagnosed.
Definition Sema.h:7914
@ UPPC_FixedUnderlyingType
The fixed underlying type of an enumeration.
Definition Sema.h:7934
@ UPPC_RequiresClause
Definition Sema.h:7982
@ UPPC_UsingDeclaration
A using declaration.
Definition Sema.h:7940
@ UPPC_IfExists
Microsoft __if_exists.
Definition Sema.h:7964
@ UPPC_Requirement
Definition Sema.h:7979
@ UPPC_ExceptionType
The type of an exception.
Definition Sema.h:7958
@ UPPC_EnumeratorValue
The enumerator value.
Definition Sema.h:7937
@ UPPC_Lambda
Lambda expression.
Definition Sema.h:7970
@ UPPC_IfNotExists
Microsoft __if_not_exists.
Definition Sema.h:7967
@ UPPC_PartialSpecialization
Partial specialization.
Definition Sema.h:7961
@ UPPC_Initializer
An initializer.
Definition Sema.h:7949
@ UPPC_BaseType
The base type of a class type.
Definition Sema.h:7919
@ UPPC_FriendDeclaration
A friend declaration.
Definition Sema.h:7943
@ UPPC_DefaultArgument
A default argument.
Definition Sema.h:7952
@ UPPC_DeclarationType
The type of an arbitrary declaration.
Definition Sema.h:7922
@ UPPC_Expression
An arbitrary expression.
Definition Sema.h:7916
@ UPPC_DeclarationQualifier
A declaration qualifier.
Definition Sema.h:7946
@ UPPC_DataMemberType
The type of a data member.
Definition Sema.h:7925
@ UPPC_StaticAssertExpression
The expression in a static assertion.
Definition Sema.h:7931
@ UPPC_Block
Block expression.
Definition Sema.h:7973
@ UPPC_BitFieldWidth
The size of a bit-field.
Definition Sema.h:7928
@ UPPC_NonTypeTemplateParameterType
The type of a non-type template parameter.
Definition Sema.h:7955
@ UPPC_TypeConstraint
A type constraint.
Definition Sema.h:7976
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
Definition Sema.h:1150
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var)
Add an init-capture to a lambda scope.
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
CXXConstructorDecl * LookupDefaultConstructor(CXXRecordDecl *Class)
Look up the default constructor for the given class.
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, Expr *ArgExpr, DeclAccessPair FoundDecl)
Checks access to an overloaded member operator, including conversion operators.
void checkAllowedCUDAInitializer(VarDecl *VD)
Definition SemaCUDA.cpp:515
void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
Definition SemaExpr.cpp:403
StmtResult ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributesView &Attrs, SourceRange Range)
Stmt attributes - this routine is the top level dispatcher.
const LangOptions & getLangOpts() const
Definition Sema.h:1518
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
Definition Sema.h:12614
QualType CheckComparisonCategoryType(ComparisonCategoryType Kind, SourceLocation Loc, ComparisonCategoryUsage Usage)
Lookup the specified comparison category types in the standard library, an check the VarDecls possibl...
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
void ActOnObjCTemporaryExitContainerContext(DeclContext *DC)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
void PopParsingDeclaration(ParsingDeclState state, Decl *decl)
bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, ParsedTemplateTy *Template=nullptr)
Determine whether a particular identifier might be the name in a C++1z deduction-guide declaration.
bool RequireCompleteExprType(Expr *E, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
bool RebuildTemplateParamsInCurrentInstantiation(TemplateParameterList *Params)
Rebuild the template parameters now that we know we're in a current instantiation.
SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMember SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
void DiagnoseInvalidJumps(Stmt *Body)
bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const ParsedAttributesView &AttrList)
bool CaptureHasSideEffects(const sema::Capture &From)
Does copying/destroying the captured variable have side effects?
OMPClause * ActOnOpenMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acquire' clause.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent)
DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was not used in the declaration of ...
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
Definition Sema.h:6986
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
AccessResult CheckStructuredBindingMemberAccess(SourceLocation UseLoc, CXXRecordDecl *DecomposedClass, DeclAccessPair Field)
Checks implicit access to a member in a structured binding.
void LookupVisibleDecls(Scope *S, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope=true, bool LoadExternal=true)
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
QualType CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
SourceLocation CurInitSegLoc
Definition Sema.h:714
DLLImportAttr * mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI)
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
Ensure attributes are consistent with type.
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispMode Value)
Called on well formed #pragma vtordisp().
Definition SemaAttr.cpp:524
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl< Expr * > &ConvertedArgs, bool AllowExplicit=false, bool IsListInitialization=false)
Given a constructor and the set of arguments provided for the constructor, convert the arguments and ...
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind NewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
void EnterTemplatedContext(Scope *S, DeclContext *DC)
Enter a template parameter scope, after it's been associated with a particular DeclContext.
void CheckAlignasUnderalignment(Decl *D)
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
ReuseLambdaContextDecl_t
Definition Sema.h:4912
@ ReuseLambdaContextDecl
Definition Sema.h:4912
void ActOnBaseSpecifiers(Decl *ClassDecl, MutableArrayRef< CXXBaseSpecifier * > Bases)
ActOnBaseSpecifiers - Attach the given base specifiers to the class, after checking whether there are...
SemaDiagnosticBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Definition SemaCUDA.cpp:642
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
SectionAttr * mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
void CodeCompleteObjCSelector(Scope *S, ArrayRef< IdentifierInfo * > SelIdents)
TypeVisibilityAttr * mergeTypeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, TypeVisibilityAttr::VisibilityType Vis)
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions=None, OverloadCandidateParamOrder PO={})
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
NamedDecl * findLocallyScopedExternCDecl(DeclarationName Name)
Look for a locally scoped extern "C" declaration by the given name.
bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old)
We've determined that New is a redeclaration of Old.
void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange)
CheckCastAlign - Implements -Wcast-align, which warns when a pointer cast increases the alignment req...
ASTConsumer & getASTConsumer() const
Definition Sema.h:1526
NonOdrUseReason getNonOdrUseReasonInCurrentContext(ValueDecl *D)
If D cannot be odr-used in the current expression evaluation context, return a reason explaining why.
void DefineDefaultedComparison(SourceLocation Loc, FunctionDecl *FD, DefaultedComparisonKind DCK)
bool isUnexpandedParameterPackPermitted()
Determine whether an unexpanded parameter pack might be permitted in this location.
bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A, const NamedDecl *B)
Determine if A and B are equivalent internal linkage declarations from different modules,...
void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc)
Produce diagnostics if FD is an aligned allocation or deallocation function that is unavailable.
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, unsigned ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
Definition SemaCUDA.cpp:701
void MarkFunctionParmPackReferenced(FunctionParmPackExpr *E)
Perform reference-marking and odr-use handling for a FunctionParmPackExpr.
void * OpaqueParser
Definition Sema.h:895
ExprResult ConvertParamDefaultArgument(const ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
LazyVector< VarDecl *, ExternalSemaSource, &ExternalSemaSource::ReadTentativeDefinitions, 2, 2 > TentativeDefinitionsType
Definition Sema.h:847
Preprocessor & PP
Definition Sema.h:398
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
VariadicCallType getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto, Expr *Fn)
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, TrivialABIHandling TAH=TAH_IgnoreTrivialABI, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
bool CheckConstexprFunctionDefinition(const FunctionDecl *FD, CheckConstexprKind Kind)
void CodeCompleteObjCImplementationDecl(Scope *S)
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult BuildSynthesizedThreeWayComparison(SourceLocation OpLoc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, FunctionDecl *DefaultedFn)
AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, QualType Base, QualType Derived, const CXXBasePath &Path, unsigned DiagID, bool ForceCheck=false, bool ForceUnprivileged=false)
Checks access for a hierarchy conversion.
OMPClause * ActOnOpenMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acq_rel' clause.
StmtResult ActOnOpenMPParallelMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop simd' after parsing of the associated sta...
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
void ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope(Decl *D, SmallVectorImpl< FunctionDecl * > &Bases)
Register D as specialization of all base functions in Bases in the current omp begin/end declare vari...
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
ExprResult checkPseudoObjectIncDec(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opcode, Expr *Op)
Check an increment or decrement of a pseudo-object expression.
threadSafety::BeforeSet * ThreadSafetyDeclCache
Definition Sema.h:9063
SmallVector< PragmaAttributeGroup, 2 > PragmaAttributeStack
Definition Sema.h:736
void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super=nullptr)
ExprResult BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc)
Construct a new expression that refers to the given integral template argument with the given source-...
NamedDecl * getShadowedDeclaration(const TypedefNameDecl *D, const LookupResult &R)
Return the declaration shadowed by the given typedef D, or null if it doesn't shadow any declaration ...
AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair FoundDecl)
Perform access-control checking on a previously-unresolved member access which has now been resolved ...
bool hasVisibleMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is a member specialization declaration (as oppo...
void updateOutOfDateSelector(Selector Sel)
DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList, ArrayRef< OMPClause * > Clauses, DeclContext *Owner=nullptr)
Called on well-formed '#pragma omp allocate'.
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
bool CheckFunctionConstraints(const FunctionDecl *FD, ConstraintSatisfaction &Satisfaction, SourceLocation UsageLoc=SourceLocation())
Check whether the given function decl's trailing requires clause is satisfied, if any.
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition Sema.h:1138
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD)
void CodeCompleteObjCPropertySetter(Scope *S)
bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value)
bool hasCStrMethod(const Expr *E)
Check to see if a given expression could have '.c_str()' called on it.
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, std::vector< PartialDiagnosticAt > > DeviceDeferredDiags
Diagnostics that are emitted only if we discover that the given function must be codegen'ed.
Definition Sema.h:11887
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)
CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
const LangOptions & LangOpts
Definition Sema.h:397
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
void InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiates the definitions of all of the member of the given class, which is an instantiation of a ...
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
Definition Sema.h:9073
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition Sema.h:4513
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
std::pair< Expr *, std::string > findFailedBooleanCondition(Expr *Cond)
Find the failed Boolean condition within a given Boolean constant expression, and describe it with a ...
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, AllocationFunctionScope NewScope, AllocationFunctionScope DeleteScope, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete, bool Diagnose=true)
Finds the overloads of operator new and delete that are appropriate for the allocation.
TemplateDeductionResult
Describes the result of template argument deduction.
Definition Sema.h:8282
@ TDK_InvalidExplicitArguments
The explicitly-specified template arguments were not valid template arguments for the given template.
Definition Sema.h:8325
@ TDK_Invalid
The declaration was invalid; do nothing.
Definition Sema.h:8286
@ TDK_InstantiationDepth
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
Definition Sema.h:8289
@ TDK_Success
Template argument deduction was successful.
Definition Sema.h:8284
@ TDK_MiscellaneousDeductionFailure
Deduction failed; that's all we know.
Definition Sema.h:8332
@ TDK_ConstraintsNotSatisfied
The deduced arguments did not satisfy the constraints associated with the template.
Definition Sema.h:8330
@ TDK_NonDependentConversionFailure
Checking non-dependent argument conversions failed.
Definition Sema.h:8327
@ TDK_TooFewArguments
When performing template argument deduction for a function template, there were too few call argument...
Definition Sema.h:8322
@ TDK_Incomplete
Template argument deduction did not deduce a value for every template parameter.
Definition Sema.h:8292
@ TDK_CUDATargetMismatch
CUDA Target attributes do not match.
Definition Sema.h:8334
@ TDK_DeducedMismatchNested
After substituting deduced template arguments, an element of a dependent parameter type did not match...
Definition Sema.h:8313
@ TDK_DeducedMismatch
After substituting deduced template arguments, a dependent parameter type did not match the correspon...
Definition Sema.h:8309
@ TDK_Inconsistent
Template argument deduction produced inconsistent deduced values for the given template parameter.
Definition Sema.h:8298
@ TDK_NonDeducedMismatch
A non-depnedent component of the parameter did not match the corresponding component of the argument.
Definition Sema.h:8316
@ TDK_TooManyArguments
When performing template argument deduction for a function template, there were too many call argumen...
Definition Sema.h:8319
@ TDK_IncompletePack
Template argument deduction did not deduce a value for every expansion of an expanded template parame...
Definition Sema.h:8295
@ TDK_Underqualified
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
Definition Sema.h:8303
@ TDK_SubstitutionFailure
Substitution of the deduced template argument values resulted in an error.
Definition Sema.h:8306
StmtResult ActOnAttributedStmt(SourceLocation AttrLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
Definition SemaStmt.cpp:558
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
void MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD, bool ConstexprOnly=false)
MarkVirtualMembersReferenced - Will mark all members of the given CXXRecordDecl referenced.
bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType)
IsMemberPointerConversion - Determines whether the conversion of the expression From,...
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
std::unique_ptr< sema::FunctionScopeInfo > CachedFunctionScope
Definition Sema.h:769
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Definition Sema.h:4180
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
Definition Sema.cpp:2108
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, ArrayRef< Expr * > Arg, SourceLocation RParenLoc, Expr *Config=nullptr, bool IsExecConfig=false, ADLCallKind UsesADL=ADLCallKind::NotADL)
BuildResolvedCallExpr - Build a call to a resolved expression, i.e.
void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D, const VirtSpecifiers *VS=nullptr)
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition Sema.h:4490
NamedDecl * ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope, ArrayRef< BindingDecl * > Bindings=None)
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
ExprResult CheckForImmediateInvocation(ExprResult E, FunctionDecl *Decl)
Wrap the expression in a ConstantExpr if it is a potential immediate invocation.
SmallVector< Scope *, 2 > CurrentSEHFinally
Stack of active SEH __finally scopes. Can be empty.
Definition Sema.h:428
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
Definition Sema.h:883
void ActOnStartOfCompoundStmt(bool IsStmtExpr)
Definition SemaStmt.cpp:384
void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl)
DiagnoseTemplateParameterShadow - Produce a diagnostic complaining that the template parameter 'PrevD...
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
Definition Sema.h:816
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
bool CollectStats
Flag indicating whether or not to collect detailed statistics.
Definition Sema.h:405
bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange, const sema::Capture &From)
Diagnose if an explicit lambda capture is unused.
void DefineInheritingConstructor(SourceLocation UseLoc, CXXConstructorDecl *Constructor)
Define the specified inheriting constructor.
void ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind)
Definition Sema.cpp:942
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
CXXRecordDecl * getStdBadAlloc() const
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenOrBraceLoc, MultiExprArg Exprs, SourceLocation RParenOrBraceLoc, bool ListInitialization)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
FieldDecl * CheckFieldDecl(DeclarationName Name, QualType T, TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, InClassInitStyle InitStyle, SourceLocation TSSL, AccessSpecifier AS, NamedDecl *PrevDecl, Declarator *D=nullptr)
Build a new FieldDecl and check its well-formedness.
void CheckUnusedVolatileAssignment(Expr *E)
Check whether E, which is either a discarded-value expression or an unevaluated operand,...
ObjCLiteralKind
Definition Sema.h:3557
@ LK_Dictionary
Definition Sema.h:3559
@ LK_String
Definition Sema.h:3562
@ LK_Numeric
Definition Sema.h:3560
StmtResult ActOnIfStmt(SourceLocation IfLoc, bool IsConstexpr, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition SemaStmt.cpp:580
bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType, unsigned *ArgPos=nullptr)
FunctionParamTypesAreEqual - This routine checks two function proto types for equality of their argum...
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
QualType CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckDestructorDeclarator - Called by ActOnDeclarator to check the well-formednes of the destructor d...
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true)
PragmaClangSection PragmaClangRelroSection
Definition Sema.h:463
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
LazyVector< TypedefNameDecl *, ExternalSemaSource, &ExternalSemaSource::ReadExtVectorDecls, 2, 2 > ExtVectorDeclsType
Definition Sema.h:803
CXXMethodDecl * DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit move assignment operator for the given class.
bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass, QualType BaseType)
Checks access to Target from the given class.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
Definition Sema.h:431
void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM)
Diagnose why the specified class does not have a trivial special member of the given kind.
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
Definition Sema.h:6992
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
Definition SemaExpr.cpp:187
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
void CheckCXXDefaultArguments(FunctionDecl *FD)
CheckCXXDefaultArguments - Verify that the default arguments for a function declaration are well-form...
SmallVector< Decl *, 2 > WeakTopLevelDecl
WeakTopLevelDecl - Translation-unit scoped declarations generated by #pragma weak during processing o...
Definition Sema.h:1084
ComparisonCategoryUsage
Definition Sema.h:5593
@ OperatorInExpression
The '<=>' operator was used in an expression and a builtin operator was selected.
@ DefaultedOperator
A defaulted 'operator<=>' needed the comparison category.
void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl, SourceLocation FinalLoc, bool IsFinalSpelledSealed, SourceLocation LBraceLoc)
ActOnStartCXXMemberDeclarations - Invoked when we have parsed a C++ record definition's base-specifie...
SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations
Queue of implicit template instantiations that cannot be performed eagerly.
Definition Sema.h:9081
SmallVector< InventedTemplateParameterInfo, 4 > InventedParameterInfos
Stack containing information needed when in C++2a an 'auto' is encountered in a function declaration ...
Definition Sema.h:789
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
Definition SemaExpr.cpp:57
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
bool isInOpenMPAssumeScope() const
Check if there is an active global omp begin assumes directive.
Definition Sema.h:10390
void startOpenMPCXXRangeFor()
If the current region is a range loop-based region, mark the start of the loop construct.
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition Sema.h:1126
bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS)
checkUnsafeAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained type.
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
ExprResult ActOnNoexceptSpec(SourceLocation NoexceptLoc, Expr *NoexceptExpr, ExceptionSpecificationType &EST)
Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level)
Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.) for FD based on DSA for the...
DeclResult ActOnModuleImport(SourceLocation StartLoc, SourceLocation ExportLoc, SourceLocation ImportLoc, ModuleIdPath Path)
The parser has processed a module import declaration.
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
NamespaceDecl * lookupStdExperimentalNamespace()
QualType InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any ArgDependent DiagnoseIfAttr...
static StringRef getPrintable(StringRef S)
Definition Sema.h:2021
OMPClause * ActOnOpenMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'seq_cst' clause.
void MaybeAddCUDAConstantAttr(VarDecl *VD)
May add implicit CUDAConstantAttr attribute to VD, depending on VD and current compilation settings.
Definition SemaCUDA.cpp:635
Optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
TypeLoc getReturnTypeLoc(FunctionDecl *FD) const
PragmaStack< AlignPackInfo > AlignPackStack
Definition Sema.h:670
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
bool canDelayFunctionBody(const Declarator &D)
Determine whether we can delay parsing the body of a function or function template until it is used,...
static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Definition Sema.h:754
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained).
Definition Sema.h:8728
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
Definition Sema.h:1386
void CodeCompleteNamespaceDecl(Scope *S)
StmtResult ActOnExprStmtError()
Definition SemaStmt.cpp:62
PragmaStack< StringLiteral * > BSSSegStack
Definition Sema.h:680
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
void CodeCompleteDesignator(const QualType BaseType, llvm::ArrayRef< Expr * > InitExprs, const Designation &D)
Trigger code completion for a record of BaseType.
void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, const CXXRecordDecl *RD)
Mark the exception specifications of all virtual member functions in the given class as needed.
bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Target, SourceLocation TargetLoc, const FunctionProtoType *Source, SourceLocation SourceLoc)
CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...
StmtResult ActOnOpenMPForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for simd' after parsing of the associated statement.
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
bool hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true, bool AllowNonTemplateFunctions=false)
Optional< std::pair< FunctionDecl *, Expr * > > checkOpenMPDeclareVariantFunction(DeclGroupPtrTy DG, Expr *VariantRef, OMPTraitInfo &TI, SourceRange SR)
Checks '#pragma omp declare variant' variant function and original functions after parsing of the ass...
void completeExprArrayBound(Expr *E)
DeclContext * getCurLexicalContext() const
Definition Sema.h:12639
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
CopyElisionSemanticsKind
Definition Sema.h:4719
@ CES_AsIfByStdMove
Definition Sema.h:4726
@ CES_AllowParameters
Definition Sema.h:4721
@ CES_AllowDifferentTypes
Definition Sema.h:4722
@ CES_FormerDefault
Definition Sema.h:4724
@ CES_Strict
Definition Sema.h:4720
@ CES_Default
Definition Sema.h:4725
@ CES_AllowExceptionVariables
Definition Sema.h:4723
llvm::DenseMap< ParmVarDecl *, llvm::TinyPtrVector< ParmVarDecl * > > UnparsedDefaultArgInstantiationsMap
Definition Sema.h:1373
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T, TagDecl *OwnedTagDecl=nullptr)
Retrieve a version of the type 'T' that is elaborated by Keyword, qualified by the nested-name-specif...
bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl)
CheckOverloadedOperatorDeclaration - Check whether the declaration of this overloaded operator is wel...
bool hasExplicitCallingConv(QualType T)
NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name, SourceLocation NameLoc, const Token &NextToken, CorrectionCandidateCallback *CCC=nullptr)
Perform name lookup on the given name, classifying it based on the results of name lookup and the fol...
Definition SemaDecl.cpp:852
OpaquePtr< QualType > TypeTy
Definition Sema.h:392
void PrintInstantiationStack()
Prints the current instantiation stack through a series of notes.
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition Sema.h:1144
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
Definition SemaStmt.cpp:67
OpenCLOptions OpenCLFeatures
Definition Sema.h:394
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
Decl * ActOnConceptDefinition(Scope *S, MultiTemplateParamsArg TemplateParameterLists, IdentifierInfo *Name, SourceLocation NameLoc, Expr *ConstraintExpr)
StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp)
ActOnCapScopeReturnStmt - Utility routine to type-check return statements for capturing scopes.
VarArgKind isValidVarArgType(const QualType &Ty)
Determine the degree of POD-ness for an expression.
Definition SemaExpr.cpp:867
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
Optional< unsigned > getFullyPackExpandedSize(TemplateArgument Arg)
Given a template argument that contains an unexpanded parameter pack, but which has already been subs...
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
void ExitDeclaratorContext(Scope *S)
bool isQualifiedMemberAccess(Expr *E)
Determine whether the given expression is a qualified member access expression, of a form that could ...
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP declare target region.
Definition Sema.h:10471
void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI)
Diagnose shadowing for variables shadowed in the lambda record LambdaRD when these variables are capt...
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
Definition Sema.cpp:623
void CodeCompleteNaturalLanguage()
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir)
void CodeCompleteOperatorName(Scope *S)
RecordDecl * CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, unsigned NumParams)
bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D)
Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...
void CheckConstructor(CXXConstructorDecl *Constructor)
CheckConstructor - Checks a fully-formed constructor for well-formedness, issuing any diagnostics req...
void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a block pointer.
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition SemaAttr.cpp:719
bool buildCoroutineParameterMoves(SourceLocation Loc)
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
bool hasGlobalOpenMPAssumes() const
Check if there is an active global omp assumes directive.
Definition Sema.h:10393
DeclGroupPtrTy ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc)
The parser has processed a global-module-fragment declaration that begins the definition of the globa...
void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope, CapturedRegionKind Kind, unsigned NumParams)
FormatAttr * mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Format, int FormatIdx, int FirstArg)
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id)
void CheckMSVCRTEntryPoint(FunctionDecl *FD)
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Definition Sema.h:710
StmtResult ActOnOpenMPMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop simd' after parsing of the associated statement.
void CodeCompleteObjCProtocolReferences(ArrayRef< IdentifierLocPair > Protocols)
void DiagnoseMisalignedMembers()
Diagnoses the current set of gathered accesses.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
CXXRecordDecl * getCurrentClass(Scope *S, const CXXScopeSpec *SS)
Get the class that is directly named by the current context.
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
Decl * ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, const ParsedAttributesView &Attrs, SourceLocation EqualLoc, Expr *Val)
sema::FunctionScopeInfo * getCurFunction() const
Definition Sema.h:1830
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input)
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for' after parsing of the associa...
void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS)
checkUnsafeExprAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained expressi...
void PushCompoundScope(bool IsStmtExpr)
Definition Sema.cpp:2033
bool usesPartialOrExplicitSpecialization(SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec)
ProcessingContextState ParsingClassState
Definition Sema.h:4865
QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel sections' after parsing of the associated statement.
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
FunctionDecl * CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID, SourceLocation Loc)
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
Scope * getNonFieldDeclScope(Scope *S)
getNonFieldDeclScope - Retrieves the innermost scope, starting from S, where a non-field would be dec...
StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target enter data' after parsing of the associated statement.
void handleLambdaNumbering(CXXRecordDecl *Class, CXXMethodDecl *Method, Optional< std::tuple< bool, unsigned, unsigned, Decl * > > Mangling=None)
Number lambda for linkage purposes if necessary.
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
void pushCodeSynthesisContext(CodeSynthesisContext Ctx)
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
bool mightBeIntendedToBeTemplateName(ExprResult E, bool &Dependent)
Determine whether it's plausible that E was intended to be a template-name.
Definition Sema.h:2554
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, Optional< unsigned > NumExpansions, bool ExpectParameterPack)
void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc)
ActOnPragmaWeakID - Called on well formed #pragma weak ident.
bool CheckNontrivialField(FieldDecl *FD)
CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller, const FunctionDecl *Callee)
Identifies relative preference of a given Caller/Callee combination, based on their host/device attri...
Definition SemaCUDA.cpp:165
ExprResult ActOnOpenMPCall(ExprResult Call, Scope *Scope, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig)
Given the potential call expression Call, determine if there is a specialization via the OpenMP decla...
StmtResult ActOnOpenMPTargetTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute' after parsing of the associated statement...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
Definition SemaExpr.cpp:210
void CodeCompleteObjCAtVisibility(Scope *S)
bool isValidPointerAttrType(QualType T, bool RefOkay=false)
Determine if type T is a valid subject for a nonnull and similar attributes.
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
bool NeedToCaptureVariable(VarDecl *Var, SourceLocation Loc)
Checks if the variable must be captured.
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, Expr *SrcExpr)
DiagnoseAssignmentEnum - Warn if assignment to enum is a constant integer not in the range of enum va...
ExprResult ActOnFinishTrailingRequiresClause(ExprResult ConstraintExpr)
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method)
Check whether 'this' shows up in the attributes of the given static member function.
CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier *NNS)
If the given nested name specifier refers to the current instantiation, return the declaration that c...
void CodeCompleteNamespaceAliasDecl(Scope *S)
bool ActOnDuplicateDefinition(DeclSpec &DS, Decl *Prev, SkipBodyInfo &SkipBody)
Perform ODR-like check for C/ObjC when merging tag types from modules.
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, ObjCPropertyDecl *SuperProperty, const IdentifierInfo *Name, bool OverridingProtocolProperty)
DiagnosePropertyMismatch - Compares two properties for their attributes and types and warns on a vari...
ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
void MarkCaptureUsedInEnclosingContext(VarDecl *Capture, SourceLocation Loc, unsigned CapturingScopeIndex)
CXXBaseSpecifier * CheckBaseSpecifier(CXXRecordDecl *Class, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
Definition Sema.h:4003
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
Definition Sema.cpp:1850
DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
The main callback when the parser finds something like expression .
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, bool IsDefiniteInstance, const Scope *S)
Builds an implicit member access expression.
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
Definition Sema.h:1382
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl * > Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S, bool MergeTypeWithOld)
MergeFunctionDecl - We just parsed a function 'New' from declarator D which has the same name and sco...
void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, const Stmt *Body, unsigned DiagID)
Emit DiagID if statement located on StmtLoc has a suspicious null statement as a Body,...
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion)
type checking for vector binary operators.
void ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc, OMPDeclareTargetDeclAttr::MapTypeTy MT, OMPDeclareTargetDeclAttr::DevTypeTy DT)
Called on correct id-expression from the '#pragma omp declare target'.
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, TypeSourceInfo *T, bool IsPackExpansion)
bool hasMergedDefinitionInCurrentModule(NamedDecl *Def)
void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add the overload candidates named by callee and/or found by argument dependent lookup to the given ov...
StmtResult ActOnOpenMPTaskDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp task' after parsing of the associated statement.
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
Definition Sema.h:12670
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, const InternalLinkageAttr &AL)
NamespaceDecl * StdExperimentalNamespaceCache
The C++ "std::experimental" namespace, where the experimental parts of the standard library resides.
Definition Sema.h:1106
void MarkThisReferenced(CXXThisExpr *This)
bool MaybeEmitAmbiguousAtomicConstraintsDiagnostic(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2)
If D1 was not at least as constrained as D2, but would've been if a pair of atomic constraints involv...
void DiagnoseEmptyLoopBody(const Stmt *S, const Stmt *PossibleBody)
Warn if a for/while loop statement S, which is followed by PossibleBody, has a suspicious null statem...
ExprResult DefaultLvalueConversion(Expr *E)
Definition SemaExpr.cpp:623
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition Sema.h:8736
void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL, unsigned ByteNo) const
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Definition Sema.h:2154
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition Sema.h:713
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD)
AddOverriddenMethods - See if a method overrides any in the base classes, and if so,...
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition Sema.h:1168
void maybeExtendBlockObject(ExprResult &E)
Do an explicit extend of the given block pointer if we're in ARC.
static bool isCast(CheckedConversionKind CCK)
Definition Sema.h:11194
VarDecl * getCopyElisionCandidate(QualType ReturnType, Expr *E, CopyElisionSemanticsKind CESK)
Determine whether the given expression is a candidate for copy elision in either a return statement o...
void setCurrentOpenCLExtensionForType(QualType T)
Set current OpenCL extensions for a type which can only be used when these OpenCL extensions are enab...
Definition Sema.cpp:2471
void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockError - If there is an error parsing a block, this callback is invoked to pop the informati...
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
QualType BuildExtIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a extended int type.
void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled)
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
OMPClause * ActOnOpenMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'mergeable' clause.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
Definition Sema.cpp:2065
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, ADLResult &Functions)
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Definition Sema.h:836
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
FunctionDecl * resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult)
Given an expression that refers to an overloaded function, try to resolve that function to a single f...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Definition Sema.h:411
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition Sema.h:3947
@ NotForRedeclaration
The lookup is a reference to this name that is not for the purpose of redeclaring the name.
Definition Sema.h:3950
@ ForVisibleRedeclaration
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
Definition Sema.h:3953
@ ForExternalRedeclaration
The lookup results will be used for redeclaration of a name with external linkage; non-visible lookup...
Definition Sema.h:3957
void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope)
Initialization of captured region for OpenMP region.
llvm::PointerIntPair< CXXRecordDecl *, 3, CXXSpecialMember > SpecialMemberDecl
Definition Sema.h:1438
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound=nullptr)
We first select the type of the method: Instance or Factory, then collect all methods with that type.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
bool CheckOpenMPLinearDecl(const ValueDecl *D, SourceLocation ELoc, OpenMPLinearClauseKind LinKind, QualType Type, bool IsDeclareSimd=false)
Checks that the specified declaration matches requirements for the linear decls.
ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, Expr *CastExpr, CastKind &CastKind, ExprValueKind &VK, CXXCastPath &Path)
Check a cast of an unknown-any type.
StmtResult ActOnOpenMPDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute' after parsing of the associated statement.
void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, Declarator &D, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, Expr *E, SourceLocation RParenLoc)
ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const,addrspace}_cast's.
Definition SemaCast.cpp:263
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
DeclGroupPtrTy ActOnPrivateModuleFragmentDecl(SourceLocation ModuleLoc, SourceLocation PrivateLoc)
The parser has processed a private-module-fragment declaration that begins the definition of the priv...
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
VarDecl * ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
SuppressedDiagnosticsMap SuppressedDiagnostics
Definition Sema.h:8766
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl, bool ConsiderCudaAttrs=true, bool ConsiderRequiresClauses=true)
@ VAK_Invalid
Definition Sema.h:11270
@ VAK_ValidInCXX11
Definition Sema.h:11267
@ VAK_MSVCUndefined
Definition Sema.h:11269
@ VAK_Undefined
Definition Sema.h:11268
void ActOnFinishedFunctionDefinitionInOpenMPAssumeScope(Decl *D)
Act on D, a function definition inside of an omp [begin/end] assumes.
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
llvm::DenseMap< Selector, GlobalMethods > GlobalMethodPool
Definition Sema.h:1407
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
Definition Sema.h:9136
TypeSourceInfo * RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, SourceLocation Loc, DeclarationName Name)
Rebuilds a type within the context of the current instantiation.
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition SemaAttr.cpp:444
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp barrier'.
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
bool isPreciseFPEnabled()
Are precise floating point semantics currently enabled?
Definition Sema.h:9901
bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
StmtResult ActOnOpenMPMasterDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp master' after parsing of the associated statement.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD, const LookupResult &Previous)
May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, depending on FD and the current co...
Definition SemaCUDA.cpp:586
void setOpenCLExtensionForType(QualType T, llvm::StringRef Exts)
Set OpenCL extensions for a type which can only be used when these OpenCL extensions are enabled.
Definition Sema.cpp:2452
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition SemaAttr.cpp:681
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
static SourceRange getPrintable(TypeLoc TL)
Definition Sema.h:2031
StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskgroup'.
bool DiagnoseDependentMemberLookup(LookupResult &R)
Diagnose a lookup that found results in an enclosing class during error recovery.
bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer)
RecordDecl * MSVCGuidDecl
The MSVC "_GUID" struct, which is defined in MSVC header files.
Definition Sema.h:1120
QualType QIDNSCopying
id<NSCopying> type.
Definition Sema.h:1165
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
TrivialABIHandling
Definition Sema.h:3026
@ TAH_IgnoreTrivialABI
The triviality of a method unaffected by "trivial_abi".
Definition Sema.h:3028
@ TAH_ConsiderTrivialABI
The triviality of a method affected by "trivial_abi".
Definition Sema.h:3031
void FillInlineAsmIdentifierInfo(Expr *Res, llvm::InlineAsmIdentifierInfo &Info)
CXXMethodDecl * LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the moving assignment operator for the given class.
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
Definition Sema.h:8977
MethodMatchStrategy
Definition Sema.h:4402
@ MMS_strict
Definition Sema.h:4404
@ MMS_loose
Definition Sema.h:4403
void PushForceCUDAHostDevice()
Increments our count of the number of times we've seen a pragma forcing functions to be host device.
Definition SemaCUDA.cpp:29
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair FoundDecl)
OMPClause * ActOnOpenMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'release' clause.
bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl)
CheckLiteralOperatorDeclaration - Check whether the declaration of this literal operator function is ...
SmallVector< LateInstantiatedAttribute, 16 > LateInstantiatedAttrVec
Definition Sema.h:9301
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
llvm::SmallVector< TypoExpr *, 2 > TypoExprs
Holds TypoExprs that are created from createDelayedTypo.
Definition Sema.h:437
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
Definition Sema.h:11325
@ IncompatiblePointerDiscardsQualifiers
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
Definition Sema.h:11363
@ IntToPointer
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension.
Definition Sema.h:11335
@ IncompatibleBlockPointer
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
Definition Sema.h:11387
@ IncompatibleObjCQualifiedId
IncompatibleObjCQualifiedId - The assignment is between a qualified id type and something else (that ...
Definition Sema.h:11392
@ IncompatibleVectors
IncompatibleVectors - The assignment is between two vector types that have the same size,...
Definition Sema.h:11379
@ CompatiblePointerDiscardsQualifiers
CompatiblePointerDiscardsQualifiers - The assignment discards c/v/r qualifiers, which we accept as an...
Definition Sema.h:11358
@ IncompatiblePointer
IncompatiblePointer - The assignment is between two pointers types that are not compatible,...
Definition Sema.h:11343
@ IncompatibleObjCWeakRef
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier.
Definition Sema.h:11396
@ Compatible
Compatible - the types are compatible according to the standard.
Definition Sema.h:11327
@ Incompatible
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST.
Definition Sema.h:11400
@ FunctionVoidPointer
FunctionVoidPointer - The assignment is between a function pointer and void*, which the standard does...
Definition Sema.h:11339
@ IncompatibleFunctionPointer
IncompatibleFunctionPointer - The assignment is between two function pointers types that are not comp...
Definition Sema.h:11348
@ IncompatiblePointerSign
IncompatiblePointerSign - The assignment is between two pointers types which point to integers which ...
Definition Sema.h:11354
@ IncompatibleNestedPointerQualifiers
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types,...
Definition Sema.h:11375
@ IncompatibleNestedPointerAddressSpaceMismatch
IncompatibleNestedPointerAddressSpaceMismatch - The assignment changes address spaces in nested point...
Definition Sema.h:11369
@ PointerToInt
PointerToInt - The assignment converts a pointer to an int, which we accept as an extension.
Definition Sema.h:11331
@ IntToBlockPointer
IntToBlockPointer - The assignment converts an int to a block pointer.
Definition Sema.h:11383
CXXMethodDecl * DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit copy assignment operator for the given class.
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
void MarkVirtualBaseDestructorsReferenced(SourceLocation Location, CXXRecordDecl *ClassDecl, llvm::SmallPtrSetImpl< const RecordType * > *DirectVirtualBases=nullptr)
Mark destructors of virtual bases of this class referenced.
CXXConstructorDecl * LookupMovingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the moving constructor for the given class.
ParserCompletionContext
Describes the context in which code completion occurs.
Definition Sema.h:12128
@ PCC_RecoveryInFunction
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
Definition Sema.h:12162
@ PCC_LocalDeclarationSpecifiers
Code completion occurs within a sequence of declaration specifiers within a function,...
Definition Sema.h:12170
@ PCC_Template
Code completion occurs following one or more template headers.
Definition Sema.h:12144
@ PCC_MemberTemplate
Code completion occurs following one or more template headers within a class.
Definition Sema.h:12147
@ PCC_Expression
Code completion occurs within an expression.
Definition Sema.h:12149
@ PCC_ObjCInterface
Code completion occurs within an Objective-C interface, protocol, or category.
Definition Sema.h:12135
@ PCC_Class
Code completion occurs within a class, struct, or union.
Definition Sema.h:12132
@ PCC_ObjCImplementation
Code completion occurs within an Objective-C implementation or category implementation.
Definition Sema.h:12138
@ PCC_ParenthesizedExpression
Code completion occurs in a parenthesized expression, which might also be a type cast.
Definition Sema.h:12167
@ PCC_Namespace
Code completion occurs at top-level or namespace context.
Definition Sema.h:12130
@ PCC_Type
Code completion occurs where only a type is permitted.
Definition Sema.h:12164
@ PCC_Condition
Code completion occurs within the condition of an if, while, switch, or for statement.
Definition Sema.h:12158
@ PCC_ForInit
Code completion occurs at the beginning of the initialization statement (or expression) in a for loop...
Definition Sema.h:12155
@ PCC_Statement
Code completion occurs within a statement, which may also be an expression or a declaration.
Definition Sema.h:12152
@ PCC_ObjCInstanceVariableList
Code completion occurs within the list of instance variables in an Objective-C interface,...
Definition Sema.h:12141
void checkIllFormedTrivialABIStruct(CXXRecordDecl &RD)
Check that the C++ class annoated with "trivial_abi" satisfies all the conditions that are needed for...
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
void CheckShadowingDeclModification(Expr *E, SourceLocation Loc)
Warn if 'E', which is an expression that is about to be modified, refers to a shadowing declaration.
SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II, SourceLocation IILoc)
Determine whether the body of an anonymous enumeration should be skipped.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc, const ParsedAttr &AL, bool IsAsync)
Do a check to make sure Name looks like a legal argument for the swift_name attribute applied to decl...
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnCapturedRegionEnd(Stmt *S)
ArithConvKind
Context in which we're performing a usual arithmetic conversion.
Definition Sema.h:11299
@ ACK_Arithmetic
An arithmetic operation.
Definition Sema.h:11301
@ ACK_CompAssign
A compound assignment expression.
Definition Sema.h:11309
@ ACK_BitwiseOp
A bitwise operation.
Definition Sema.h:11303
@ ACK_Conditional
A conditional (?:) operator.
Definition Sema.h:11307
@ ACK_Comparison
A comparison.
Definition Sema.h:11305
StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute simd' after parsing of the associated stat...
void notePreviousDefinition(const NamedDecl *Old, SourceLocation New)
Decl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
StmtResult ActOnOpenMPCriticalDirective(const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp critical' after parsing of the associated statement.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.
CXXMethodDecl * LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the copying assignment operator for the given class.
bool isInOpenMPDeclareVariantScope() const
Can we exit an OpenMP declare variant scope at the moment.
Definition Sema.h:10266
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization)
Perform semantic checking of a new function declaration.
bool isKnownName(StringRef name)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared.
Definition Sema.h:1172
TemplateNameKind ActOnTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a template name from a name that is syntactically required to name a template,...
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, const PartialDiagnostic &PD, FunctionDecl *FD=nullptr)
Definition Sema.h:11972
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS)
Check for comparisons of floating point operands using != and ==.
Decl * ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
DeclContext * OriginalLexicalContext
Generally null except when we temporarily switch decl contexts, like in.
Definition Sema.h:415
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, VarDecl *OmpPrivParm)
Finish current declare reduction construct initializer.
llvm::PointerIntPair< ConstantExpr *, 1 > ImmediateInvocationCandidate
Definition Sema.h:1221
bool MSStructPragmaOn
Definition Sema.h:421
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
ExprResult TransformToPotentiallyEvaluated(Expr *E)
unsigned ActOnReenterTemplateScope(Decl *Template, llvm::function_ref< Scope *()> EnterScope)
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
unsigned NonInstantiationEntries
The number of CodeSynthesisContexts that are not template instantiations and, therefore,...
Definition Sema.h:8712
QualType ProduceCallSignatureHelp(Scope *S, Expr *Fn, ArrayRef< Expr * > Args, SourceLocation OpenParLoc)
Reports signatures for a call to CodeCompleteConsumer and returns the preferred type for the current ...
CheckedConversionKind
The kind of conversion being performed.
Definition Sema.h:11181
@ CCK_OtherCast
A cast other than a C-style cast.
Definition Sema.h:11189
@ CCK_ForBuiltinOverloadedOp
A conversion for an operand of a builtin overloaded operator.
Definition Sema.h:11191
@ CCK_CStyleCast
A C-style cast.
Definition Sema.h:11185
@ CCK_ImplicitConversion
An implicit conversion.
Definition Sema.h:11183
@ CCK_FunctionalCast
A functional-style cast.
Definition Sema.h:11187
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition Sema.h:1415
bool canSkipFunctionBody(Decl *D)
Determine whether we can skip parsing the body of a function definition, assuming we don't care about...
bool canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, QualType NewT, QualType OldT)
Determines if we can perform a correct type check for D as a redeclaration of PrevDecl.
ExprResult CreateUnresolvedLookupExpr(CXXRecordDecl *NamingClass, NestedNameSpecifierLoc NNSLoc, DeclarationNameInfo DNI, const UnresolvedSetImpl &Fns, bool PerformADL=true)
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
Definition Sema.h:8948
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
Definition Sema.h:2944
@ NTK_Typedef
Definition Sema.h:2949
@ NTK_NonUnion
Definition Sema.h:2947
@ NTK_TypeAlias
Definition Sema.h:2950
@ NTK_NonClass
Definition Sema.h:2946
@ NTK_NonEnum
Definition Sema.h:2948
@ NTK_NonStruct
Definition Sema.h:2945
@ NTK_TemplateTemplateArgument
Definition Sema.h:2953
@ NTK_TypeAliasTemplate
Definition Sema.h:2952
@ NTK_Template
Definition Sema.h:2951
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID)
Definition Sema.h:2223
void ActOnObjCContainerFinishDefinition()
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
void ActOnOpenMPEndDeclareVariant()
Handle a omp end declare variant.
SourceManager & getSourceManager() const
Definition Sema.h:1523
void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
@ TryCapture_Implicit
Definition Sema.h:4955
@ TryCapture_ExplicitByVal
Definition Sema.h:4955
@ TryCapture_ExplicitByRef
Definition Sema.h:4955
StmtResult ActOnOpenMPTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute' after parsing of the associated statement.
bool isCFError(RecordDecl *D)
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Definition Sema.h:6091
AssignmentAction
Definition Sema.h:3334
@ AA_Returning
Definition Sema.h:3337
@ AA_Passing_CFAudited
Definition Sema.h:3342
@ AA_Initializing
Definition Sema.h:3339
@ AA_Converting
Definition Sema.h:3338
@ AA_Assigning
Definition Sema.h:3335
@ AA_Passing
Definition Sema.h:3336
@ AA_Casting
Definition Sema.h:3341
@ AA_Sending
Definition Sema.h:3340
FunctionDecl * SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, FunctionDecl *Spaceship)
Substitute the name and return type of a defaulted 'operator<=>' to form an implicit 'operator=='.
CallingConventionIgnoredReason
Describes the reason a calling convention specification was ignored, used for diagnostics.
Definition Sema.h:12751
bool checkStringLiteralArgumentAttr(const ParsedAttr &Attr, unsigned ArgNum, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument ArgNum of Attr is a ASCII string literal.
CommonAttr * mergeCommonAttr(Decl *D, const CommonAttr &AL)
NamedDecl * ActOnDecompositionDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists)
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=None, ArrayRef< DeclGroupPtrTy > allTUVars=None)
QualType buildLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions, IdentifierInfo *Id, bool DirectInit, Expr *&Init)
ExprResult checkPseudoObjectRValue(Expr *E)
bool CheckVecStepExpr(Expr *E)
bool DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD, SourceLocation ReturnLoc, Expr *&RetExpr, AutoType *AT)
Deduce the return type for a function from a returned expression, per C++1y [dcl.spec....
bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo)
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
Definition Sema.cpp:458
bool isModuleVisible(const Module *M, bool ModulePrivate=false)
Decl * ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TemplateParams)
Handle a friend type declaration.
void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversion=false, OverloadCandidateParamOrder PO={})
AddMethodCandidate - Adds a named decl (which is some kind of method) as a method candidate to the gi...
std::pair< CXXRecordDecl *, SourceLocation > VTableUse
The list of classes whose vtables have been used within this translation unit, and the source locatio...
Definition Sema.h:6982
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, SourceLocation Less, SourceLocation Greater)
llvm::DenseSet< FunctionDeclAndLoc > LocsWithCUDACallDiags
FunctionDecls and SourceLocations for which CheckCUDACall has emitted a (maybe deferred) "bad call" d...
Definition Sema.h:11899
void CodeCompleteBracketDeclarator(Scope *S)
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input)
bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old, Scope *S, bool MergeTypeWithOld)
Completes the merge of two function declarations that are known to be compatible.
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
Definition Sema.cpp:720
void ActOnFinishOpenMPDeclareTargetDirective()
Called at the end of target region i.e. '#pragme omp end declare target'.
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, const ParsedAttributesView &Attr)
void DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc)
Declare implicit deduction guides for a class template if we've not already done so.
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
void EnterDeclaratorContext(Scope *S, DeclContext *DC)
EnterDeclaratorContext - Used when we must lookup names in the context of a declarator's nested name ...
ClassTemplateDecl * lookupCoroutineTraits(SourceLocation KwLoc, SourceLocation FuncLoc)
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
bool areMultiversionVariantFunctionsCompatible(const FunctionDecl *OldFD, const FunctionDecl *NewFD, const PartialDiagnostic &NoProtoDiagID, const PartialDiagnosticAt &NoteCausedDiagIDAt, const PartialDiagnosticAt &NoSupportDiagIDAt, const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported, bool ConstexprSupported, bool CLinkageMayDiffer)
Checks if the variant/multiversion functions are compatible.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
bool CheckExplicitlyDefaultedComparison(Scope *S, FunctionDecl *MD, DefaultedComparisonKind DCK)
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition Sema.h:1153
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
bool CheckTemplateTemplateArgument(TemplateTemplateParmDecl *Param, TemplateParameterList *Params, TemplateArgumentLoc &Arg)
Check a template argument against its corresponding template template parameter.
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
CheckVectorCompareOperands - vector comparisons are a clang extension that operates on extended vecto...
ExprResult ActOnDependentMemberExpr(Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
DeclResult CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation TemplateNameLoc, const TemplateArgumentListInfo &TemplateArgs)
Get the specialization of the given variable template corresponding to the specified argument list,...
llvm::FoldingSet< SpecialMemberOverloadResultEntry > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
Definition Sema.h:1352
ExprResult CheckLValueToRValueConversionOperand(Expr *E)
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
Definition SemaAttr.cpp:378
Decl * ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, Expr *LangStr, SourceLocation LBraceLoc)
ActOnStartLinkageSpecification - Parsed the beginning of a C++ linkage specification,...
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, Qualifiers ThisTypeQuals)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
void ActOnTagStartDefinition(Scope *S, Decl *TagDecl)
ActOnTagStartDefinition - Invoked when we have entered the scope of a tag's definition (e....
CanThrowResult canThrow(const Stmt *E)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConverion=false, bool Complain=false, SourceRange OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
The parser has processed a module import translated from a #include or similar preprocessing directiv...
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors.
Definition Sema.h:7276
void actOnDelayedExceptionSpecification(Decl *Method, ExceptionSpecificationType EST, SourceRange SpecificationRange, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr)
Add an exception-specification to the given member function (or member function template).
Decl * ActOnExceptionDeclarator(Scope *S, Declarator &D)
ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch handler.
void DiscardMisalignedMemberAddress(const Type *T, Expr *E)
This function checks if the expression is in the sef of potentially misaligned members and it is conv...
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, Optional< unsigned > NumExpansions)
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
PragmaClangSection PragmaClangTextSection
Definition Sema.h:464
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
bool resolveAndFixAddressOfSingleOverloadCandidate(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false)
Given an overloaded function, tries to turn it into a non-overloaded function reference using resolve...
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation)
Builds a using declaration.
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member,...
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
NonTrivialCUnionKind
Definition Sema.h:2727
@ NTCUK_Destruct
Definition Sema.h:2729
@ NTCUK_Init
Definition Sema.h:2728
@ NTCUK_Copy
Definition Sema.h:2730
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
void CheckLookupAccess(const LookupResult &R)
Checks access to all the declarations in the given result set.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
CodeSegAttr * mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
QualType BuildAtomicType(QualType T, SourceLocation Loc)
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
PragmaClangSection PragmaClangDataSection
Definition Sema.h:461
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
SemaDiagnosticBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
Definition SemaCUDA.cpp:672
void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression)
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc, ObjCPropertyQueryKind QueryKind)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
void ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, SmallVectorImpl< FunctionDecl * > &Bases)
The declarator D defines a function in the scope S which is nested in an omp begin/end declare varian...
DeclGroupPtrTy ActOnOpenMPDeclareMapperDirective(Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType, SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS, Expr *MapperVarRef, ArrayRef< OMPClause * > Clauses, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare mapper'.
StmtResult ActOnOpenMPTargetParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for simd' after parsing of the associated statemen...
ParsedType actOnLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init)
Perform initialization analysis of the init-capture and perform any implicit conversions such as an l...
Definition Sema.h:6576
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
void FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true)
void * SkippedDefinitionContext
Definition Sema.h:3105
bool isLaxVectorConversion(QualType srcType, QualType destType)
Is this a legal conversion between two types, one of which is known to be a vector type?
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute.
ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member, SourceLocation AsmLoc)
ExprResult ActOnNameClassifiedAsUndeclaredNonType(IdentifierInfo *Name, SourceLocation NameLoc)
Act on the result of classifying a name as an undeclared (ADL-only) non-type declaration.
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
Definition Sema.cpp:1909
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
Instantiate or parse a C++ default argument expression as necessary.
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig, bool AllowTypoCorrection=true, bool CalleesAddressIsTaken=false)
BuildOverloadedCallExpr - Given the call expression that calls Fn (which eventually refers to the dec...
void ActOnObjCReenterContainerContext(DeclContext *DC)
void ActOnPragmaRedefineExtname(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaRedefineExtname - Called on well formed #pragma redefine_extname oldname newname.
bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams)
Check whether a template can be declared within this scope.
llvm::SmallDenseMap< const ValueDecl *, const Expr *, 4 > VarsWithInheritedDSAType
Definition Sema.h:10499
PragmaStack< MSVtorDispMode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
Definition Sema.h:669
TypeSourceInfo * ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition SemaAttr.cpp:86
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
ExprResult BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, SourceLocation nameLoc, IndirectFieldDecl *indirectField, DeclAccessPair FoundDecl=DeclAccessPair::make(nullptr, AS_none), Expr *baseObjectExpr=nullptr, SourceLocation opLoc=SourceLocation())
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition Sema.h:4495
MaybeODRUseExprSet MaybeODRUseExprs
Definition Sema.h:767
ExternalSemaSource * getExternalSource() const
Definition Sema.h:1528
void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an initializer for the declaration ...
unsigned FunctionScopesStart
The index of the first FunctionScope that corresponds to the current context.
Definition Sema.h:777
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition Sema.h:717
NamedDecl * lookupOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id, NamedDeclSetType &SameDirectiveDecls)
Searches for the provided declaration name for OpenMP declare target directive.
QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, bool ConvertArgs=true)
Definition Sema.h:11543
bool InstantiateInClassInitializer(SourceLocation PointOfInstantiation, FieldDecl *Instantiation, FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the definition of a field from the given pattern.
void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, bool IsInstantiation=false)
ActOnLambdaError - If there is an error parsing a lambda, this callback is invoked to pop the informa...
StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp section' after parsing of the associated statement.
static SourceRange getPrintable(SourceRange R)
Definition Sema.h:2028
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
Helpers for dealing with blocks and functions.
void ActOnFinishCXXMemberSpecification(Scope *S, SourceLocation RLoc, Decl *TagDecl, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
void ActOnOpenMPBeginDeclareVariant(SourceLocation Loc, OMPTraitInfo &TI)
Handle a omp begin declare variant.
void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, WeakInfo &W)
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
void ActOnUndeclaredTypeTemplateName(Scope *S, TemplateTy &Name, TemplateNameKind &TNK, SourceLocation NameLoc, IdentifierInfo *&II)
Try to resolve an undeclared template name as a type template.
ExprResult BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToObjectOfClassType - Build a call to an object of class type (C++ [over....
void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e....
bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
Perform semantic analysis for the given non-template member specialization.
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, CXXSpecialMember CSM, CXXMethodDecl *MemberDecl, bool ConstRHS, bool Diagnose)
Given a implicit special member, infer its CUDA target from the calls it needs to make to underlying ...
Definition SemaCUDA.cpp:282
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed.
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
Definition Sema.h:2210
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K, unsigned OpenMPCaptureLevel=0)
Definition Sema.cpp:2429
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
MinSizeAttr * mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI)
std::pair< const IdentifierInfo *, uint64_t > TypeTagMagicValue
A pair of ArgumentKind identifier and magic value.
Definition Sema.h:12563
void emitDeferredDiags()
Definition Sema.cpp:1659
VarDecl * isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo=false, unsigned StopAt=0)
Check if the specified variable is used in one of the private clauses (private, firstprivate,...
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
bool WarnedStackExhausted
Definition Sema.h:1506
ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, CastKind &Kind)
void CodeCompleteObjCInterfaceCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
Definition Sema.h:1117
void InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
CorrectTypoKind
Definition Sema.h:4132
@ CTK_NonError
Definition Sema.h:4133
@ CTK_ErrorRecovery
Definition Sema.h:4134
void CheckCompleteVariableDeclaration(VarDecl *VD)
bool CanPerformAggregateInitializationForOverloadResolution(const InitializedEntity &Entity, InitListExpr *From)
Determine whether we can perform aggregate initialization for the purposes of overload resolution.
ExprResult ActOnRequiresClause(ExprResult ConstraintExpr)
@ Global
The global module fragment, between 'module;' and a module-declaration.
Definition Sema.h:1781
@ Normal
A normal translation unit fragment.
Definition Sema.h:1785
void checkClassLevelCodeSegAttribute(CXXRecordDecl *Class)
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
bool isStdInitializerList(QualType Ty, QualType *Element)
Tests whether Ty is an instance of std::initializer_list and, if it is and Element is not NULL,...
DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, ArrayRef< Decl * > Group)
void setFunctionHasBranchProtectedScope()
Definition Sema.cpp:2055
std::pair< ObjCMethodList, ObjCMethodList > GlobalMethods
Definition Sema.h:1406
void MergeVarDecl(VarDecl *New, LookupResult &Previous)
MergeVarDecl - We just parsed a variable 'New' which has the same name and scope as a previous declar...
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
QualType BuildUnaryTransformType(QualType BaseType, UnaryTransformType::UTTKind UKind, SourceLocation Loc)
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc)
bool isSameOrCompatibleFunctionType(CanQualType Param, CanQualType Arg)
Compare types for equality with respect to possibly compatible function types (noreturn adjustment,...
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
void CUDASetLambdaAttrs(CXXMethodDecl *Method)
Set device or host device attributes on the given lambda operator() method.
Definition SemaCUDA.cpp:803
FunctionEmissionStatus getEmissionStatus(FunctionDecl *Decl, bool Final=false)
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Definition Sema.h:1094
DeclResult ActOnVarTemplateSpecialization(Scope *S, Declarator &D, TypeSourceInfo *DI, SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization)
StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block)
DelayedDiagnosticsState ParsingDeclState
Definition Sema.h:911
ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II, SourceLocation NameLoc, bool IsTemplateTypeArg)
Attempt to behave like MSVC in situations where lookup of an unqualified type name has failed in a de...
Definition SemaDecl.cpp:556
SpeculativeLoadHardeningAttr * mergeSpeculativeLoadHardeningAttr(Decl *D, const SpeculativeLoadHardeningAttr &AL)
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare mapper' construct.
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType)
OMPClause * ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
void NoteOverloadCandidate(NamedDecl *Found, FunctionDecl *Fn, OverloadCandidateRewriteKind RewriteKind=OverloadCandidateRewriteKind(), QualType DestType=QualType(), bool TakingAddress=false)
StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope)
void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, bool IsSuper=false)
void ActOnStartOfTranslationUnit()
This is called before the very first declaration in the translation unit is parsed.
Definition Sema.cpp:930
CCEKind
Contexts in which a converted constant expression is required.
Definition Sema.h:3456
@ CCEK_ExplicitBool
Condition in an explicit(bool) specifier.
Definition Sema.h:3462
@ CCEK_ArrayBound
Array bound in array declarator or new-expression.
Definition Sema.h:3460
@ CCEK_CaseValue
Expression in a case label.
Definition Sema.h:3457
@ CCEK_TemplateArg
Value of a non-type template parameter.
Definition Sema.h:3459
@ CCEK_ConstexprIf
Condition in a constexpr if statement.
Definition Sema.h:3461
@ CCEK_Enumerator
Enumerator value with fixed underlying type.
Definition Sema.h:3458
void StartOpenMPClause(OpenMPClauseKind K)
Start analysis of clauses.
FunctionTemplateDecl * getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, unsigned NumCallArguments2, bool Reversed=false)
Returns the more specialized function template according to the rules of function template partial or...
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(NamedDecl *D, const TemplateArgumentList *Innermost=nullptr, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions.
FunctionDecl * getCurFunctionDecl()
getCurFunctionDecl - If inside of a function body, this returns a pointer to the function decl for th...
Definition Sema.cpp:1343
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
CUDAFunctionTarget
Definition Sema.h:11982
@ CFT_HostDevice
Definition Sema.h:11986
@ CFT_InvalidTarget
Definition Sema.h:11987
bool hasVisibleMergedDefinition(NamedDecl *Def)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
Definition SemaStmt.cpp:772
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
void MarkUnusedFileScopedDecl(const DeclaratorDecl *D)
If it's a file scoped decl that must warn if not used, keep track of it.
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
void actOnObjCTypeArgsOrProtocolQualifiers(Scope *S, ParsedType baseType, SourceLocation lAngleLoc, ArrayRef< IdentifierInfo * > identifiers, ArrayRef< SourceLocation > identifierLocs, SourceLocation rAngleLoc, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl< ParsedType > &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl< Decl * > &protocols, SourceLocation &protocolRAngleLoc, bool warnOnIncompleteProtocols)
Given a list of identifiers (and their locations), resolve the names to either Objective-C protocol q...
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
void setRoundingMode(SourceLocation Loc, llvm::RoundingMode)
Called to set constant rounding mode for floating point operations.
OMPClause * ActOnOpenMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
StmtResult ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection, SourceLocation RParenLoc, BuildForRangeKind Kind)
ActOnCXXForRangeStmt - Check and build a C++11 for-range statement.
TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl * > protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)
Build a an Objective-C protocol-qualified 'id' type where no base type was specified.
bool isInOpenMPTargetExecutionDirective() const
Return true inside OpenMP target region.
ASTConsumer & Consumer
Definition Sema.h:400
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)
OverloadKind CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool IsForUsingDecl)
Determine whether the given New declaration is an overload of the declarations in Old.
RequiresExprBodyDecl * ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, ArrayRef< ParmVarDecl * > LocalParameters, Scope *BodyScope)
void AddFunctionCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, bool SuppressUserConversions=false, bool PartialOverloading=false, bool FirstArgumentIsBase=false)
Add all of the function declarations in the given function set to the overload candidate set.
void ActOnFinishCXXMemberDecls()
Perform any semantic analysis which needs to be delayed until all pending class member declarations h...
const DeclContext * getCurObjCLexicalContext() const
Definition Sema.h:12643
void inheritCUDATargetAttrs(FunctionDecl *FD, const FunctionTemplateDecl &TD)
Copies target attributes from the template TD to the function FD.
Definition SemaCUDA.cpp:850
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
StmtResult ActOnOpenMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskwait'.
OverloadKind
C++ Overloading.
Definition Sema.h:3346
@ Ovl_NonFunction
This is not an overload because the lookup results contain a non-function.
Definition Sema.h:3357
@ Ovl_Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
Definition Sema.h:3349
@ Ovl_Match
This is not an overload because the signature exactly matches an existing declaration.
Definition Sema.h:3353
bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
PragmaAlignPackDiagnoseKind
Definition Sema.h:9836
Decl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList)
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType.
SmallVector< ExprWithCleanups::CleanupObject, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
Definition Sema.h:758
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
Definition SemaExpr.cpp:103
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
Definition Sema.h:9062
bool hasUncompilableErrorOccurred() const
Whether uncompilable error has occurred.
Definition Sema.cpp:1471
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
Definition Sema.h:9077
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, InheritedConstructorInfo *ICI=nullptr, bool Diagnose=false)
Determine if a special member function should have a deleted definition when it is defaulted.
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size attribute to a particular declar...
Decl * ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec, SourceLocation RBraceLoc)
ActOnFinishLinkageSpecification - Complete the definition of the C++ linkage specification LinkageSpe...
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType(), bool TakingAddress=false)
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters are used in a given expression.
OMPClause * ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'threads' clause.
void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal, unsigned NewWidth, bool NewSign, SourceLocation Loc, unsigned DiagID)
ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have the specified width and sign...
static QualType getPrintable(QualType T)
Definition Sema.h:2027
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
void CodeCompleteConstructorInitializer(Decl *Constructor, ArrayRef< CXXCtorInitializer * > Initializers)
QualType GetSignedVectorType(QualType V)
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
Definition Sema.cpp:56
StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested)
OMPClause * ActOnOpenMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'atomic_default_mem_order' clause.
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
void incrementMSManglingNumber() const
Definition Sema.h:12630
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
bool isAcceptableNestedNameSpecifier(const NamedDecl *SD, bool *CanCorrect=nullptr)
Determines whether the given declaration is an valid acceptable result for name lookup of a nested-na...
DeclResult ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, const ParsedAttributesView &Attr)
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
void AddNonMemberOperatorCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
Add all of the non-member operator function declarations in the given function set to the overload ca...
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD=nullptr)
WebAssemblyImportModuleAttr * mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL)
QualType CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc)
Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
void AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(FunctionDecl *FD)
If this function is a C++ replaceable global allocation function (C++2a [basic.stc....
void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool IncompleteImpl=false)
ImplMethodsVsClassMethods - This is main routine to warn if any method remains unimplemented in the c...
bool inferObjCARCLifetime(ValueDecl *decl)
VarDecl * createLambdaInitCaptureVarDecl(SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc, IdentifierInfo *Id, unsigned InitStyle, Expr *Init)
Create a dummy variable within the declcontext of the lambda's call operator, for name lookup purpose...
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all.
Definition Sema.h:1176
@ UnevaluatedAbstract
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
@ UnevaluatedList
The current expression occurs within a braced-init-list within an unevaluated operand.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ DiscardedStatement
The current expression occurs within a discarded statement.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ PotentiallyEvaluatedIfUsed
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
CUDAFunctionTarget CurrentCUDATarget()
Gets the CUDA target for the current context.
Definition Sema.h:12000
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
unsigned LastEmittedCodeSynthesisContextDepth
The depth of the context stack at the point when the most recent error or warning was produced.
Definition Sema.h:8720
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
AvailabilityPriority
Describes the kind of priority given to an availability attribute.
Definition Sema.h:3248
@ AP_PragmaClangAttribute
The availability attribute was applied using '#pragma clang attribute'.
Definition Sema.h:3254
@ AP_InferredFromOtherPlatform
The availability attribute for a specific platform was inferred from an availability attribute for an...
Definition Sema.h:3258
@ AP_Explicit
The availability attribute was specified explicitly next to the declaration.
Definition Sema.h:3251
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated",...
Definition Sema.h:3222
@ AMK_None
Don't merge availability attributes at all.
Definition Sema.h:3224
@ AMK_Override
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
Definition Sema.h:3230
@ AMK_ProtocolImplementation
Merge availability attributes for an implementation of a protocol requirement.
Definition Sema.h:3233
@ AMK_Redeclaration
Merge availability attributes for a redeclaration, which requires an exact match.
Definition Sema.h:3227
void ActOnDocumentableDecls(ArrayRef< Decl * > Group)
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind)
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
void CheckStaticLocalForDllExport(VarDecl *VD)
Check if VD needs to be dllexport/dllimport due to being in a dllexport/import function.
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID, const FunctionProtoType *Superset, SourceLocation SuperLoc, const FunctionProtoType *Subset, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, Optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
ParsedType getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path)
void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace)
ActOnFinishNamespaceDef - This callback is called after a namespace is exited.
void CodeCompletePreprocessorMacroName(bool IsDefinition)
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
void RecordParsingTemplateParameterDepth(unsigned Depth)
This is used to inform Sema what the current TemplateParameterDepth is during Parsing.
Definition Sema.cpp:1920
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
OMPClause * ActOnOpenMPNumTasksClause(Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
MemInitResult BuildMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, Expr *Init, SourceLocation EllipsisLoc)
Handle a C++ member initializer.
UuidAttr * mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI, StringRef UuidAsWritten, MSGuidDecl *GuidDecl)
void ActOnAfterCompoundStatementLeadingPragmas()
Definition SemaStmt.cpp:388
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
Definition SemaStmt.cpp:72
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls)
void DiagnoseUseOfUnimplementedSelectors()
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
Definition Sema.h:1091
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, ReferenceConversions *Conv=nullptr)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context)
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
bool EnsureTemplateArgumentListConstraints(TemplateDecl *Template, ArrayRef< TemplateArgument > TemplateArgs, SourceRange TemplateIDRange)
Ensure that the given template arguments satisfy the constraints associated with the given template,...
void DiagnoseUnterminatedPragmaAttribute()
Definition SemaAttr.cpp:980
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
LateTemplateParserCB * LateTemplateParser
Definition Sema.h:893
void DiagnoseAmbiguousLookup(LookupResult &Result)
Produce a diagnostic describing the ambiguity that resulted from name lookup.
EnforceTCBLeafAttr * mergeEnforceTCBLeafAttr(Decl *D, const EnforceTCBLeafAttr &AL)
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
Decl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD)
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
LazyVector< CXXConstructorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadDelegatingConstructors, 2, 2 > DelegatingCtorDeclsType
Definition Sema.h:865
bool isEmptyCudaConstructor(SourceLocation Loc, CXXConstructorDecl *CD)
Definition SemaCUDA.cpp:424
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted, bool UpdateArgsWithConversions=true, bool *ConstraintsNotSatisfied=nullptr)
Check that the given template arguments can be be provided to the given template, converting the argu...
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
Definition Sema.h:829
bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl)
Checks if the new declaration declared in dependent context must be put in the same redeclaration cha...
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Definition Sema.h:850
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Called by ActOnProperty and HandlePropertyInClassExtension to handle creating the ObjcPropertyDecl fo...
void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedExpr::IdentKind IK)
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
OMPClause * ActOnOpenMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'read' clause.
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
void CodeCompleteObjCPropertyGetter(Scope *S)
void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init)
Check that the lifetime of the initializer (and its subobjects) is sufficient for initializing the en...
QualType getLambdaConversionFunctionResultType(const FunctionProtoType *CallOpType, CallingConv CC)
Get the return type to use for a lambda's conversion function(s) to function pointer type,...
StmtResult ActOnOpenMPTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop simd' after parsing of the associated statement.
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
bool RebuildingImmediateInvocation
Whether the AST is currently being rebuilt to correct immediate invocations.
Definition Sema.h:1012
void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass, bool ObjCPropertyAccess, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReceiver=nullptr)
StmtResult ActOnOpenMPSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp sections' after parsing of the associated statement.
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition Sema.h:9801
@ RTC_Incompatible
Definition Sema.h:9803
@ RTC_Compatible
Definition Sema.h:9802
@ RTC_Unknown
Definition Sema.h:9804
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit.
Definition Sema.cpp:2448
void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record)
Perform semantic checks on a class definition that has been completing, introducing implicitly-declar...
void DiscardCleanupsInEvaluationContext()
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
ExprResult PerformQualificationConversion(Expr *E, QualType Ty, ExprValueKind VK=VK_RValue, CheckedConversionKind CCK=CCK_ImplicitConversion)
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
Definition Sema.h:1299
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
StmtResult ActOnOpenMPParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for' after parsing of the associated statement.
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
bool LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization, RequiredTemplateKind RequiredTemplate=SourceLocation(), AssumedTemplateKind *ATK=nullptr, bool AllowTypoCorrection=true)
void makeMergedDefinitionVisible(NamedDecl *ND)
Make a merged definition of an existing hidden definition ND visible at the specified location.
void makeModuleVisible(Module *Mod, SourceLocation ImportLoc)
Definition Sema.h:2149
bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, unsigned OpenMPCaptureLevel) const
Return true if the provided declaration VD should be captured by reference.
QualType getCompletedType(Expr *E)
Get the type of expression E, triggering instantiation to complete the type if necessary – that is,...
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
SourceManager & SourceMgr
Definition Sema.h:402
MemberExpr * BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec *SS, SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl, bool HadMultipleCandidates, const DeclarationNameInfo &MemberNameInfo, QualType Ty, ExprValueKind VK, ExprObjectKind OK, const TemplateArgumentListInfo *TemplateArgs=nullptr)
TemplateNameIsRequiredTag
Definition Sema.h:7330
@ TemplateNameIsRequired
Definition Sema.h:7330
bool CheckDestructor(CXXDestructorDecl *Destructor)
CheckDestructor - Checks a fully-formed destructor definition for well-formedness,...
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > Expansions)
MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, SourceLocation EllipsisLoc)
Handle a C++ member initializer using parentheses syntax.
ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, IdentifierInfo &Name, SourceLocation NameLoc, SourceLocation RParenLoc)
Called when an expression computing the size of a parameter pack is parsed.
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const
Determine whether FD is an aligned allocation or deallocation function that is unavailable.
StmtResult ActOnOpenMPTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp teams' after parsing of the associated statement.
Decl * BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record)
BuildMicrosoftCAnonymousStruct - Handle the declaration of an Microsoft C anonymous structure.
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AL, bool IncludeCXX11Attributes=true)
TypeSourceInfo * SubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
Definition SemaAttr.cpp:312
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class,...
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
DiagnosticsEngine & Diags
Definition Sema.h:401
void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers)
void DiagnoseUnterminatedPragmaAlignPack()
Definition SemaAttr.cpp:417
StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope)
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Definition Sema.h:4565
OpenCLOptions & getOpenCLOptions()
Definition Sema.h:1519
FPOptions CurFPFeatures
Definition Sema.h:395
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, RecordDecl *&AnonRecord)
ParsedFreeStandingDeclSpec - This method is invoked when a declspec with no declarator (e....
void ActOnStartSEHFinallyBlock()
CXXConstructorDecl * DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit copy constructor for the given class.
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CorrectionCandidateCallback &CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args=None, TypoExpr **Out=nullptr)
Diagnose an empty lookup.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
NamespaceDecl * getStdNamespace() const
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
StmtResult BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition SemaStmt.cpp:634
RedeclarationKind forRedeclarationInCurContext()
Definition Sema.h:3960
void DeclareImplicitEqualityComparison(CXXRecordDecl *RD, FunctionDecl *Spaceship)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
bool AttachBaseSpecifiers(CXXRecordDecl *Class, MutableArrayRef< CXXBaseSpecifier * > Bases)
Performs the actual work of attaching the given base class specifiers to a C++ class.
void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an initializer for the declaratio...
NamedDecl * ActOnTypedefDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous)
void CodeCompleteAfterFunctionEquals(Declarator &D)
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
Definition SemaExpr.cpp:503
PragmaStack< StringLiteral * > DataSegStack
Definition Sema.h:679
LazyVector< const DeclaratorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2 > UnusedFileScopedDeclsType
Definition Sema.h:857
OMPClause * ActOnOpenMPVarListClause(OpenMPClauseKind Kind, ArrayRef< Expr * > Vars, Expr *DepModOrTailExpr, const OMPVarListLocTy &Locs, SourceLocation ColonLoc, CXXScopeSpec &ReductionOrMapperIdScopeSpec, DeclarationNameInfo &ReductionOrMapperId, int ExtraModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, bool IsMapTypeImplicit, SourceLocation ExtraModifierLoc, ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc)
void deduceClosureReturnType(sema::CapturingScopeInfo &CSI)
Deduce a block or lambda's return type based on the return statements present in the body.
LateTemplateParserCleanupCB * LateTemplateParserCleanup
Definition Sema.h:894
SmallVector< CXXMethodDecl *, 4 > DelayedDllExportMemberFunctions
Definition Sema.h:12671
bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType)
Are the two types lax-compatible vector types? That is, given that one of them is a vector,...
NamedDecl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
@ TUK_Definition
Definition Sema.h:2968
@ TUK_Declaration
Definition Sema.h:2967
@ TUK_Friend
Definition Sema.h:2969
@ TUK_Reference
Definition Sema.h:2966
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc)
void CheckFunctionOrTemplateParamDeclarator(Scope *S, Declarator &D)
Common checks for a parameter-declaration that should apply to both function parameters and non-type ...
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
TemplateParamListContext
The context in which we are checking a template parameter list.
Definition Sema.h:7471
@ TPC_ClassTemplate
Definition Sema.h:7472
@ TPC_FriendFunctionTemplate
Definition Sema.h:7477
@ TPC_ClassTemplateMember
Definition Sema.h:7475
@ TPC_FunctionTemplate
Definition Sema.h:7474
@ TPC_FriendClassTemplate
Definition Sema.h:7476
@ TPC_FriendFunctionTemplateDefinition
Definition Sema.h:7478
@ TPC_TypeAliasTemplate
Definition Sema.h:7479
@ TPC_VarTemplate
Definition Sema.h:7473
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
void ActOnAbortSEHFinallyBlock()
NamedDecl * ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D, LookupResult &Previous, bool &Redeclaration)
ActOnTypedefNameDecl - Perform semantic checking for a declaration which declares a typedef-name,...
void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs)
ActOnFinishDelayedAttribute - Invoked when we have finished parsing an attribute for which parsing is...
bool CheckQualifiedFunctionForTypeId(QualType T, SourceLocation Loc)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
Decl * ActOnEmptyDeclaration(Scope *S, const ParsedAttributesView &AttrList, SourceLocation SemiLoc)
Handle a C++11 empty-declaration and attribute-declaration.
void CodeCompleteObjCAtStatement(Scope *S)
void DiagnoseAssignmentAsCondition(Expr *E)
DiagnoseAssignmentAsCondition - Given that an expression is being used as a boolean condition,...
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
Definition Sema.h:745
bool isEmptyCudaDestructor(SourceLocation Loc, CXXDestructorDecl *CD)
Definition SemaCUDA.cpp:462
ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK, ExprObjectKind OK, SourceLocation Loc)
StmtResult ActOnOpenMPAtomicDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp atomic' after parsing of the associated statement.
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
std::pair< SourceLocation, bool > DeleteExprLoc
Delete-expressions to be analyzed at the end of translation unit.
Definition Sema.h:827
void DiagnoseUnusedDecl(const NamedDecl *ND)
DiagnoseUnusedDecl - Emit warnings about declarations that are not used unless they are marked attr(u...
void handleDelayedAvailabilityCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
friend class ArgumentPackSubstitutionRAII
Definition Sema.h:8757
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
void PopDeclContext()
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, const ParsedAttributesView &attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
void CodeCompleteObjCInterfaceDecl(Scope *S)
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
TemplateArgumentLoc getIdentityTemplateArgumentLoc(NamedDecl *Param, SourceLocation Location)
Get a template argument mapping the given template parameter to itself, e.g.
bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation(), SourceLocation UnalignedQualLoc=SourceLocation())
AccessResult CheckMemberAccess(SourceLocation UseLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found)
Checks access to a member.
OMPClause * ActOnOpenMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nogroup' clause.
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
Definition Sema.h:1390
void PrintStats() const
Print out statistics about the semantic analysis.
Definition Sema.cpp:505
ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
StmtResult ActOnOpenMPParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel' after parsing of the associated statement.
bool CheckObjCDeclScope(Decl *D)
Checks that the Objective-C declaration is declared in the global scope.
QualType CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckConstructorDeclarator - Called by ActOnDeclarator to check the well-formedness of the constructo...
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
static unsigned getPrintable(unsigned I)
Definition Sema.h:2018
void checkVariadicArgument(const Expr *E, VariadicCallType CT)
Check to see if the given expression is a valid argument to a variadic function, issuing a diagnostic...
Definition SemaExpr.cpp:917
ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
void CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr)
CheckStaticArrayArgument - If the given argument corresponds to a static array parameter,...
@ FST_NSString
Definition Sema.h:12451
@ FST_Unknown
Definition Sema.h:12458
@ FST_Strftime
Definition Sema.h:12452
@ FST_FreeBSDKPrintf
Definition Sema.h:12455
@ FST_Strfmon
Definition Sema.h:12453
@ FST_Kprintf
Definition Sema.h:12454
@ FST_OSTrace
Definition Sema.h:12456
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
Definition Sema.h:425
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope.
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
llvm::BumpPtrAllocator BumpAlloc
Definition Sema.h:1367
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
void AddSurrogateCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, const FunctionProtoType *Proto, Expr *Object, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddSurrogateCandidate - Adds a "surrogate" candidate function that converts the given Object to a fun...
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C object pointer type.
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, ArrayRef< TemplateArgument > TemplateArgs, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
BuildForRangeKind
Definition Sema.h:4668
@ BFRK_Check
Determining whether a for-range statement could be built.
Definition Sema.h:4676
@ BFRK_Build
Initial building of a for-range statement.
Definition Sema.h:4670
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
Definition Sema.h:4673
bool resolveAssumedTemplateNameAsType(Scope *S, TemplateName &Name, SourceLocation NameLoc, bool Diagnose=true)
SmallVector< Module *, 16 > CodeSynthesisContextLookupModules
Extra modules inspected when performing a lookup during a template instantiation.
Definition Sema.h:8682
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
Definition Sema.h:408
StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl, Stmt *HandlerBlock)
ActOnCXXCatchBlock - Takes an exception declaration and a handler block and creates a proper catch ha...
void ActOnUninitializedDecl(Decl *dcl)
Decl * ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, MultiTemplateParamsArg TempParamLists)
Handle a friend tag declaration where the scope specifier was templated.
void checkNonTrivialCUnionInInitializer(const Expr *Init, SourceLocation Loc)
Emit diagnostics if the initializer or any of its explicit or implicitly-generated subexpressions req...
static Scope * getScopeForDeclContext(Scope *S, DeclContext *DC)
Finds the scope corresponding to the given decl context, if it happens to be an enclosing scope.
TypedefDecl * ParseTypedefDecl(Scope *S, Declarator &D, QualType T, TypeSourceInfo *TInfo)
Subroutines of ActOnDeclarator().
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
StmtResult ActOnOpenMPTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop' after parsing of the associated statement.
sema::LambdaScopeInfo * getEnclosingLambda() const
Get the innermost lambda enclosing the current location, if any.
Definition Sema.cpp:2092
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
Definition SemaStmt.cpp:517
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod)
The parser has left a submodule.
bool isUsualDeallocationFunction(const CXXMethodDecl *FD)
PragmaSectionKind
Definition Sema.h:9865
@ PSK_ConstSeg
Definition Sema.h:9868
@ PSK_DataSeg
Definition Sema.h:9866
@ PSK_CodeSeg
Definition Sema.h:9869
@ PSK_BSSSeg
Definition Sema.h:9867
StmtResult ActOnOpenMPTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute simd' after parsing of the associated statement.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=llvm::None)
Called on well-formed 'from' clause.
AlwaysInlineAttr * mergeAlwaysInlineAttr(Decl *D, const AttributeCommonInfo &CI, const IdentifierInfo *Ident)
void DiagnoseDeletedDefaultedFunction(FunctionDecl *FD)
Produce notes explaining why a defaulted function was defined as deleted.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
Definition Sema.cpp:449
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
Definition Sema.cpp:488
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
Definition SemaCast.cpp:286
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=llvm::None)
Called on well-formed 'reduction' clause.
Decl * ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth)
ActOnField - Each field of a C struct/union is passed into this in order to create a FieldDecl object...
bool CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
NamedDecl * DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II, SourceLocation Loc)
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &... Args)
Definition Sema.h:2235
ExprResult ActOnStmtExprResult(ExprResult E)
void EndOpenMPClause()
End analysis of clauses.
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
Definition Sema.cpp:59
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false, VarTemplateSpecializationDecl *PrevVTSD=nullptr)
BuildVariableInstantiation - Used after a new variable has been created.
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC, SkipBodyInfo *SkipBody=nullptr)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
void ActOnCXXForRangeDecl(Decl *D)
llvm::StringRef getCurrentOpenCLExtension() const
Definition Sema.h:10119
bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionReturnType - Checks whether the return types are covariant,...
bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, DeclarationName Name, SourceLocation Loc, bool IsTemplateId)
Diagnose a declaration whose declarator-id has the given nested-name-specifier.
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
std::tuple< MangleNumberingContext *, Decl * > getCurrentMangleNumberContext(const DeclContext *DC)
Compute the mangling number context for a lambda expression or block literal.
void ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled)
Called on well formed #pragma clang fp reassociate.
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE)
Redundant parentheses over an equality comparison can indicate that the user intended an assignment u...
void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)
AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T, sema::TemplateDeductionInfo &Info)
static bool isCUDAImplicitHostDeviceFunction(const FunctionDecl *D)
Definition SemaCUDA.cpp:224
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
void CodeCompleteObjCImplementationCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
llvm::SmallSet< SourceLocation, 2 > SrcLocSet
Definition Sema.h:9053
ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, SourceLocation OpLoc, DeclarationName MemberName, SourceLocation MemberLoc, SourceLocation SuperLoc, QualType SuperType, bool Super)
HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an objective C interface.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
PragmaClangSection PragmaClangBSSSection
Definition Sema.h:460
Decl * ActOnDeclarator(Scope *S, Declarator &D)
bool PopForceCUDAHostDevice()
Decrements our count of the number of times we've seen a pragma forcing functions to be host device.
Definition SemaCUDA.cpp:34
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
Definition Sema.h:419
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
AbstractDiagSelID
Definition Sema.h:7278
@ AbstractSynthesizedIvarType
Definition Sema.h:7285
@ AbstractVariableType
Definition Sema.h:7282
@ AbstractReturnType
Definition Sema.h:7280
@ AbstractNone
Definition Sema.h:7279
@ AbstractFieldType
Definition Sema.h:7283
@ AbstractArrayType
Definition Sema.h:7286
@ AbstractParamType
Definition Sema.h:7281
@ AbstractIvarType
Definition Sema.h:7284
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
MSPropertyDecl * HandleMSProperty(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS, const ParsedAttr &MSPropertyAttr)
HandleMSProperty - Analyze a __delcspec(property) field of a C++ class.
bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiate the definition of an enum from a given pattern.
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
void CodeCompletePreprocessorDirective(bool InConditional)
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
PragmaOptionsAlignKind
Definition Sema.h:9814
@ POAK_Power
Definition Sema.h:9818
@ POAK_Reset
Definition Sema.h:9820
@ POAK_Packed
Definition Sema.h:9817
@ POAK_Mac68k
Definition Sema.h:9819
@ POAK_Natural
Definition Sema.h:9816
@ POAK_Native
Definition Sema.h:9815
StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskyield'.
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
bool CheckAttrNoArgs(const ParsedAttr &CurrAttr)
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
QualType ProduceCtorInitMemberSignatureHelp(Scope *S, Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy, ArrayRef< Expr * > ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc)
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments.
void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
OMPClause * ActOnOpenMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'reverse_offload' clause.
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
Definition Sema.h:1102
ExprResult ActOnNameClassifiedAsDependentNonType(const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, bool IsAddressOfOperand)
Act on the result of classifying a name as an undeclared member of a dependent base class.
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
static const unsigned MaximumAlignment
Definition Sema.h:388
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
void LateTemplateParserCB(void *P, LateParsedTemplate &LPT)
Callback to the parser to parse templated functions when needed.
Definition Sema.h:891
StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for simd' after parsing of the associate...
Decl * ActOnFinishExportDecl(Scope *S, Decl *ExportDecl, SourceLocation RBraceLoc)
Complete the definition of an export declaration.
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
ObjCSubscriptKind
Definition Sema.h:3548
@ OS_Dictionary
Definition Sema.h:3550
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing,...
void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction, bool First=true)
Emit diagnostics explaining why a constraint expression was deemed unsatisfied.
void ActOnPragmaFPContract(SourceLocation Loc, LangOptions::FPModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *E, UnresolvedLookupExpr *Lookup)
ExprResult BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc)
Given a non-type template argument that refers to a declaration and the type of its corresponding non...
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
Definition SemaAttr.cpp:986
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, SourceRange ArgRange)
ActOnUnaryExprOrTypeTraitExpr - Handle sizeof(type) and sizeof expr and the same for alignof and __al...
Decl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc, const ParsedAttributesView &AttrList)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
ForRangeStatus BuildForRangeBeginEndCall(SourceLocation Loc, SourceLocation RangeLoc, const DeclarationNameInfo &NameInfo, LookupResult &MemberLookup, OverloadCandidateSet *CandidateSet, Expr *Range, ExprResult *CallExpr)
Build a call to 'begin' or 'end' for a C++11 for-range statement.
void clearDelayedTypo(TypoExpr *TE)
Clears the state of the given TypoExpr.
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
Definition Sema.h:9681
@ ObjCSuperMessage
The message is sent to 'super'.
Definition Sema.h:9683
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
Definition Sema.h:9688
@ ObjCInstanceMessage
The message is an instance message.
Definition Sema.h:9685
LiteralOperatorLookupResult
The possible outcomes of name lookup for a literal operator.
Definition Sema.h:3972
@ LOLR_ErrorNoDiagnostic
The lookup found no match but no diagnostic was issued.
Definition Sema.h:3976
@ LOLR_Raw
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
Definition Sema.h:3982
@ LOLR_Error
The lookup resulted in an error.
Definition Sema.h:3974
@ LOLR_Cooked
The lookup found a single 'cooked' literal operator, which expects a normal literal to be built and p...
Definition Sema.h:3979
@ LOLR_StringTemplatePack
The lookup found an overload set of literal operator templates, which expect the character type and c...
Definition Sema.h:3990
@ LOLR_Template
The lookup found an overload set of literal operator templates, which expect the characters of the sp...
Definition Sema.h:3986
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=llvm::None)
Called on well-formed 'task_reduction' clause.
void ActOnPragmaWeakAlias(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident.
sema::FunctionScopeInfo * getEnclosingFunction() const
Definition Sema.cpp:2080
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
QualType ProduceConstructorSignatureHelp(Scope *S, QualType Type, SourceLocation Loc, ArrayRef< Expr * > Args, SourceLocation OpenParLoc)
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
StmtResult ActOnOpenMPMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop' after parsing of the associated statement.
ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall)
SemaBuiltinShuffleVector - Handle __builtin_shufflevector.
void CodeCompletePreprocessorExpression()
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar)
CheckConstexprKind
Definition Sema.h:2649
@ CheckValid
Identify whether this function satisfies the formal rules for constexpr functions in the current lanu...
@ Diagnose
Diagnose issues that are non-constant or that are extensions.
ExprResult ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
void CheckVariableDeclarationType(VarDecl *NewVD)
ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr, ConditionKind CK)
sema::CompoundScopeInfo & getCurCompoundScope() const
Definition SemaStmt.cpp:400
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
Definition Sema.cpp:2440
unsigned getTemplateDepth(Scope *S) const
Determine the number of levels of enclosing template parameters.
void warnStackExhausted(SourceLocation Loc)
Warn that the stack is nearly exhausted.
Definition Sema.cpp:441
DelayedDiagnosticsState ProcessingContextState
Definition Sema.h:912
bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind, SourceLocation LinLoc)
Checks correctness of linear modifiers.
CXXSpecialMember
Kinds of C++ special members.
Definition Sema.h:1427
@ CXXCopyConstructor
Definition Sema.h:1429
@ CXXMoveConstructor
Definition Sema.h:1430
@ CXXDestructor
Definition Sema.h:1433
@ CXXDefaultConstructor
Definition Sema.h:1428
@ CXXInvalid
Definition Sema.h:1434
@ CXXMoveAssignment
Definition Sema.h:1432
@ CXXCopyAssignment
Definition Sema.h:1431
DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path, bool IsFirstDecl)
The parser has processed a module-declaration that begins the definition of a module interface or imp...
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E)
Check if declaration D used by expression E is disabled due to required OpenCL extensions being disab...
Definition Sema.cpp:2557
SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD)
Invoked when we enter a tag definition that we're skipping.
void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)
Warn when implicitly casting 0 to nullptr.
Definition Sema.cpp:528
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef< CXXCtorInitializer * > Initializers=None)
bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit, Expr *Init)
std::string getCudaConfigureFuncName() const
Returns the name of the launch configuration function.
Definition SemaCUDA.cpp:858
void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II)
Called on #pragma clang __debug dump II.
DeduceAutoResult
Result type of DeduceAutoType.
Definition Sema.h:8418
@ DAR_FailedAlreadyDiagnosed
Definition Sema.h:8421
@ DAR_Failed
Definition Sema.h:8420
@ DAR_Succeeded
Definition Sema.h:8419
void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled)
ActOnPragmaFenvAccess - Called on well formed #pragma STDC FENV_ACCESS.
bool SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Perform substitution on the base class specifiers of the given class template specialization.
void LoadExternalVTableUses()
Load any externally-stored vtable uses.
SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Definition SemaSYCL.cpp:20
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition Sema.h:1162
llvm::SmallPtrSet< const NamedDecl *, 4 > TypoCorrectedFunctionDefinitions
The function definitions which were renamed as part of typo-correction to match their respective decl...
Definition Sema.h:1467
void ActOnFinishOfCompoundStmt()
Definition SemaStmt.cpp:396
concepts::Requirement * ActOnNestedRequirement(Expr *Constraint)
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, Expr *Idx)
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, SmallVectorImpl< OriginalCallArg > const *OriginalCallArgs=nullptr, bool PartialOverloading=false, llvm::function_ref< bool()> CheckNonDependent=[]{ return false;})
Finish template argument deduction for a function template, checking the deduced template arguments f...
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
Decl * ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, const ParsedAttributesView &AttrList)
Decl * ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent, SourceLocation ScopedEnumKWLoc, bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, bool IsTypeSpecifier, bool IsTemplateParamOrArg, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, Scope *CurScope)
ActOnLambdaExpr - This is called when the body of a lambda expression was successfully completed.
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope)
Given the set of return statements within a function body, compute the variables that are subject to ...
ObjCSpecialMethodKind
Definition Sema.h:9617
@ OSMK_Copy
Definition Sema.h:9621
@ OSMK_NonRetainingInit
Definition Sema.h:9623
@ OSMK_RetainingInit
Definition Sema.h:9622
@ OSMK_None
Definition Sema.h:9618
@ OSMK_Alloc
Definition Sema.h:9619
bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2257
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
void checkNonTrivialCUnion(QualType QT, SourceLocation Loc, NonTrivialCUnionContext UseContext, unsigned NonTrivialKind)
Emit diagnostics if a non-trivial C union type or a struct that contains a non-trivial C union is use...
QualType CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, QualType *CompLHSTy=nullptr)
static ConditionResult ConditionError()
Definition Sema.h:11758
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
Definition SemaStmt.cpp:404
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate, ArrayRef< QualType > ParamTypes, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, ConversionSequenceList &Conversions, bool SuppressUserConversions, CXXRecordDecl *ActingContext=nullptr, QualType ObjectType=QualType(), Expr::Classification ObjectClassification={}, OverloadCandidateParamOrder PO={})
Check that implicit conversion sequences can be formed for each argument whose corresponding paramete...
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types.
void ActOnStartTrailingRequiresClause(Scope *S, Declarator &D)
const NormalizedConstraint * getNormalizedAssociatedConstraints(NamedDecl *ConstrainedDecl, ArrayRef< const Expr * > AssociatedConstraints)
StmtResult ActOnOpenMPParallelMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop' after parsing of the associated statemen...
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
void FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
Check if a method overloads virtual methods in a base class without overriding any.
IdentifierResolver IdResolver
Definition Sema.h:1086
void ActOnOpenMPAssumesDirective(SourceLocation Loc, OpenMPDirectiveKind DKind, ArrayRef< StringRef > Assumptions, bool SkippedClauses)
Called on well-formed '#pragma omp [begin] assume[s]'.
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
bool CheckUsingShadowDecl(UsingDecl *UD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
const TypoExprState & getTypoExprState(TypoExpr *TE) const
bool isSimpleTypeSpecifier(tok::TokenKind Kind) const
Determine whether the token kind starts a simple-type-specifier.
Definition SemaDecl.cpp:125
void DiagnoseUnusedExprResult(const Stmt *S)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused,...
Definition SemaStmt.cpp:218
llvm::DenseSet< QualType > InstantiatedNonDependentTypes
Non-dependent types used in templates that have already been instantiated by some template instantiat...
Definition Sema.h:8678
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, UnresolvedLookupExpr *AsULE=nullptr)
Builds an expression which might be an implicit member expression.
StmtResult ActOnOpenMPTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for' after parsing of the associated sta...
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType &paramType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
StmtResult ActOnOpenMPParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for simd' after parsing of the associated statement.
bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val, bool AllowMask) const
IsValueInFlagEnum - Determine if a value is allowed as part of a flag enum.
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, FunctionDecl *FDecl, const FunctionProtoType *Proto, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool ExecConfig=false)
ConvertArgumentsForCall - Converts the arguments specified in Args/NumArgs to the parameter types of ...
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
OpenMPClauseKind isOpenMPPrivateDecl(ValueDecl *D, unsigned Level, unsigned CapLevel) const
Check if the specified variable is used in 'private' clause.
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
Definition Sema.cpp:2046
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
Definition SemaStmt.cpp:535
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
ArrayRef< sema::FunctionScopeInfo * > getFunctionScopes() const
Definition Sema.h:779
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
FullExprArg MakeFullExpr(Expr *Arg)
Definition Sema.h:4558
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition Sema.h:390
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool IsTemplateName=false)
Definition SemaDecl.cpp:658
void DiagnoseSizeOfParametersAndReturnValue(ArrayRef< ParmVarDecl * > Parameters, QualType ReturnTy, NamedDecl *D)
Diagnose whether the size of parameters or return value of a function or obj-c method definition is p...
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD)
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
bool isExternalWithNoLinkageType(ValueDecl *VD)
Determine if VD, which must be a variable or function, is an external symbol that nonetheless can't b...
Definition Sema.cpp:709
llvm::SmallVector< std::pair< SourceLocation, const BlockDecl * >, 1 > ImplicitlyRetainedSelfLocs
List of SourceLocations where 'self' is implicitly retained inside a block.
Definition Sema.h:1424
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition Sema.h:1129
static int getPrintable(int I)
Definition Sema.h:2017
TypeResult ActOnTagTemplateIdType(TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy TemplateD, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc)
Parsed an elaborated-type-specifier that refers to a template-id, such as class T::template apply.
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition SemaAttr.cpp:676
bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified variable is captured by 'target' directive.
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, ArrayRef< IdentifierLocPair > ProtocolId, SmallVectorImpl< Decl * > &Protocols)
FindProtocolDeclaration - This routine looks up protocols and issues an error if they are not declare...
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Definition Sema.h:8495
OMPRequiresDecl * CheckOMPRequiresDecl(SourceLocation Loc, ArrayRef< OMPClause * > Clauses)
Check restrictions on Requires directive.
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
Definition SemaStmt.cpp:522
ObjCContainerKind getObjCContainerKind() const
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
TemplateNameKindForDiagnostics
Describes the detailed kind of a template name. Used in diagnostics.
Definition Sema.h:2540
void checkCUDATargetOverload(FunctionDecl *NewFD, const LookupResult &Previous)
Check whether NewFD is a valid overload for CUDA.
Definition SemaCUDA.cpp:811
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
CXXConstructorDecl * findInheritingConstructor(SourceLocation Loc, CXXConstructorDecl *BaseCtor, ConstructorUsingShadowDecl *DerivedShadow)
Given a derived-class using shadow declaration for a constructor and the correspnding base class cons...
static const std::string & getPrintable(const std::string &S)
Definition Sema.h:2022
PragmaClangSectionKind
pragma clang section kind
Definition Sema.h:440
@ PCSK_Invalid
Definition Sema.h:441
@ PCSK_BSS
Definition Sema.h:442
@ PCSK_Data
Definition Sema.h:443
@ PCSK_Text
Definition Sema.h:445
@ PCSK_Relro
Definition Sema.h:446
@ PCSK_Rodata
Definition Sema.h:444
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
DLLExportAttr * mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
Definition SemaStmt.cpp:492
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool IsFixed, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS)
Determine whether the identifier II is a typo for the name of the class type currently being defined.
bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, const LookupResult &R)
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
Decl * ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation TypenameLoc, CXXScopeSpec &SS, UnqualifiedId &Name, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList)
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
StmtResult ActOnOpenMPTargetDataDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target data' after parsing of the associated statement.
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
static const char * getPrintable(const char *S)
Definition Sema.h:2020
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
MSInheritanceAttr * mergeMSInheritanceAttr(Decl *D, const AttributeCommonInfo &CI, bool BestCase, MSInheritanceModel Model)
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl, SourceLocation AtEnd)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
void AddMemberOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, OverloadCandidateParamOrder PO={})
Add overload candidates for overloaded operators that are member functions.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=llvm::None)
Called on well-formed 'in_reduction' clause.
ExprResult ActOnDecltypeExpression(Expr *E)
Process the expression contained within a decltype.
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
AllocationFunctionScope
The scope in which to find allocation functions.
Definition Sema.h:6203
@ AFS_Both
Look for allocation functions in both the global scope and in the scope of the allocated class.
Definition Sema.h:6211
@ AFS_Class
Only look for allocation functions in the scope of the allocated class.
Definition Sema.h:6208
@ AFS_Global
Only look for allocation functions in the global scope.
Definition Sema.h:6205
StmtResult ActOnOpenMPSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp simd' after parsing of the associated statement.
bool isAbstractType(SourceLocation Loc, QualType T)
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false)
ASTMutationListener * getASTMutationListener() const
Definition Sema.cpp:479
Decl * ActOnStartNamespaceDef(Scope *S, SourceLocation InlineLoc, SourceLocation NamespaceLoc, SourceLocation IdentLoc, IdentifierInfo *Ident, SourceLocation LBrace, const ParsedAttributesView &AttrList, UsingDirectiveDecl *&UsingDecl)
ActOnStartNamespaceDef - This is called at the start of a namespace definition.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
PragmaMsStackAction
Definition Sema.h:466
@ PSK_Push_Set
Definition Sema.h:472
@ PSK_Reset
Definition Sema.h:467
@ PSK_Pop_Set
Definition Sema.h:473
@ PSK_Show
Definition Sema.h:471
@ PSK_Pop
Definition Sema.h:470
@ PSK_Set
Definition Sema.h:468
@ PSK_Push
Definition Sema.h:469
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD=nullptr)
Definition Sema.cpp:1745
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D, SourceLocation Loc=SourceLocation())
Determine whether the callee of a particular function call can throw.
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
Definition Sema.h:6328
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
CXXDestructorDecl * DeclareImplicitDestructor(CXXRecordDecl *ClassDecl)
Declare the implicit destructor for the given class.
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
ExprResult ActOnNameClassifiedAsOverloadSet(Scope *S, Expr *OverloadSet)
Act on the result of classifying a name as an overload set.
OMPClause * ActOnOpenMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'relaxed' clause.
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
void createImplicitModuleImportForErrorRecovery(SourceLocation Loc, Module *Mod)
Create an implicit import of the given module at the given source location, for error recovery,...
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
unsigned getHashValue() const
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
Definition Overload.h:259
Stmt - This represents one statement.
Definition Stmt.h:68
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition Stmt.cpp:324
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1758
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2118
Represents the declaration of a struct/union/class/enum.
Definition Decl.h:3277
A convenient class for passing around template argument information.
A template argument list.
Location wrapper for a TemplateArgument.
Represents a template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
This is a base class for callbacks that will be notified at every template instantiation.
Represents a C++ template name within the type system.
Stores a list of template parameters for a TemplateDecl and its derived classes.
TemplateSpecCandidateSet - A set of generalized overload candidates, used in template specializations...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
Token - This structure provides full information about a lexed token.
Definition Token.h:34
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition Decl.h:3249
Represents a declaration of a type.
Definition Decl.h:3085
Base wrapper for a particular "section" of type source info.
Definition TypeLoc.h:58
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition TypeLoc.h:152
A container of type source information.
Definition Type.h:6383
The base class of the type hierarchy.
Definition Type.h:1478
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition Decl.h:3229
Base class for declarations which introduce a typedef-name.
Definition Decl.h:3127
Simple class containing the result of Sema::CorrectTypo.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition Expr.h:6282
Represents a C++ unqualified-id that has been parsed.
Definition DeclSpec.h:950
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3077
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition ExprCXX.h:3814
A set of unresolved declarations.
The iterator over UnresolvedSets.
Represents a C++ using-declaration.
Definition DeclCXX.h:3375
Represents C++ using-directive.
Definition DeclCXX.h:2869
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition DeclCXX.h:3168
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:634
Represents a variable declaration or definition.
Definition Decl.h:834
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a C++11 virt-specifier-seq.
Definition DeclSpec.h:2615
Consumes visible declarations found when searching for all visible names within a given scope or cont...
Definition Lookup.h:765
A set of visible modules.
Definition Module.h:652
Captures information about a #pragma weak directive.
Definition Weak.h:24
A requires-expression requirement which queries the validity and properties of an expression ('simple...
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
A declaration being accessed, together with information about how it was accessed.
Retains information about a block that is currently being parsed.
Definition ScopeInfo.h:737
Retains information about a captured region.
Definition ScopeInfo.h:763
Contains information about the compound statement currently being parsed.
Definition ScopeInfo.h:68
A collection of diagnostics which were delayed.
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
Retains information about a function, method, or block that is currently being parsed.
Definition ScopeInfo.h:98
Provides information about an attempted template argument deduction, whose success or failure was des...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
void threadSafetyCleanup(BeforeSet *Cache)
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
Definition TokenKinds.h:41
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition TokenKinds.h:25
Dataflow Directional Tag Classes.
TypeSpecifierType
Specifies the kind of type.
Definition Specifiers.h:43
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
Definition Address.h:111
ArrayTypeTrait
Names for the array type traits.
Definition TypeTraits.h:42
@ CPlusPlus
MutableArrayRef< TemplateParameterList * > MultiTemplateParamsArg
Definition Ownership.h:276
CanThrowResult
Possible results from evaluation of a noexcept expression.
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
PragmaMSCommentKind
Definition PragmaKinds.h:14
ConstexprSpecKind
Define the kind of constexpr specifier.
Definition Specifiers.h:32
ObjCPropertyQueryKind
Definition DeclObjC.h:717
NullabilityKind
Describes the nullability of a particular type.
Definition Specifiers.h:303
DeductionFailureInfo MakeDeductionFailureInfo(ASTContext &Context, Sema::TemplateDeductionResult TDK, sema::TemplateDeductionInfo &Info)
Convert from Sema's representation of template deduction information to the form used in overload-can...
InClassInitStyle
In-class initialization styles for non-static data members.
Definition Specifiers.h:246
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition Specifiers.h:124
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
OverloadCandidateParamOrder
The parameter ordering that will be used for the candidate.
Definition Overload.h:85
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition OpenMPKinds.h:37
ActionResult< Decl * > DeclResult
Definition Ownership.h:268
CapturedRegionKind
The different kinds of captured statement.
StorageClass
Storage classes.
Definition Specifiers.h:223
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
TypeResult TypeError()
Definition Ownership.h:280
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition Overload.h:786
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition TypeTraits.h:51
OverloadCandidateRewriteKind
The kinds of rewrite we perform on overload candidates.
Definition Overload.h:90
LambdaCaptureInitKind
Definition DeclSpec.h:2657
@ CopyInit
[a = b], [a = {b}]
@ Result
The result type of a method or function.
ActionResult< ParsedType > TypeResult
Definition Ownership.h:264
ActionResult< CXXCtorInitializer * > MemInitResult
Definition Ownership.h:266
ParameterABI
Kinds of parameter ABI.
Definition Specifiers.h:331
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition OpenMPKinds.h:53
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
Definition LangOptions.h:54
ArrayRef< std::pair< IdentifierInfo *, SourceLocation > > ModuleIdPath
A sequence of identifier/location pairs used to describe a particular module or submodule,...
TagTypeKind
The kind of a tag type.
Definition Type.h:5300
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition Sema.h:239
LangAS
Defines the address space values used by the address space qualifier of QualType.
CastKind
CastKind - The kind of operation required for a conversion.
TranslationUnitKind
Describes the kind of translation unit being processed.
@ TU_Complete
The translation unit is a complete translation unit.
@ TU_Prefix
The translation unit is a prefix to a translation unit, and is not complete.
ComparisonCategoryType
An enumeration representing the different comparison categories types.
PragmaMSStructKind
Definition PragmaKinds.h:23
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition OpenMPKinds.h:61
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
@ TNK_Function_template
The name refers to a function template or a set of overloaded functions that includes at least one fu...
@ TNK_Concept_template
The name refers to a concept.
@ TNK_Undeclared_template
Lookup for the name failed, but we're assuming it was a template name anyway.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition OpenMPKinds.h:23
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition Lambda.h:22
PragmaFloatControlKind
Definition PragmaKinds.h:28
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition Specifiers.h:107
@ VK_RValue
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition Specifiers.h:110
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition Expr.h:60
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
Definition Specifiers.h:352
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
TPOC
The context in which partial ordering of function templates occurs.
Definition Template.h:203
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition Specifiers.h:163
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition Specifiers.h:253
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
Definition DeclObjC.h:554
U cast(CodeGen::Address addr)
Definition Address.h:108
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition OpenMPKinds.h:46
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition Ownership.h:243
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition Type.h:5319
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition OpenMPKinds.h:26
ActionResult< Expr * > ExprResult
Definition Ownership.h:262
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
Definition TypeTraits.h:21
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_None
no exception specification
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition OpenMPKinds.h:29
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition Specifiers.h:98
@ AS_none
Definition Specifiers.h:102
ActionResult< Stmt * > StmtResult
Definition Ownership.h:263
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition OpenMPKinds.h:69
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
Definition Specifiers.h:148
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion.
Definition Dominators.h:30
#define true
Definition stdbool.h:16
#define false
Definition stdbool.h:17
#define bool
Definition stdbool.h:15
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition ASTConcept.h:79
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition DeclSpec.h:1251
A structure used to record information about a failed template argument deduction,...
This little struct is used to capture information about structure field declarators,...
Definition DeclSpec.h:2607
Describes whether we've seen any nullability information for the given file.
Definition Sema.h:243
SourceLocation PointerEndLoc
The end location for the first pointer declarator in the file.
Definition Sema.h:250
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
Definition Sema.h:246
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
Definition Sema.h:256
uint8_t PointerKind
Which kind of pointer declarator we saw.
Definition Sema.h:253
Holds information about the various types of exception specification.
Definition Type.h:3934
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition Type.h:3936
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition Type.h:3939
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Definition Type.h:3942
Extra information about a function prototype.
Definition Type.h:3960
Wraps an identifier and optional source location for the identifier.
Definition ParsedAttr.h:174
Represents a complete lambda introducer.
Definition DeclSpec.h:2665
Contains a late templated function.
Definition Sema.h:12849
Decl * D
The template function declaration to be late parsed.
Definition Sema.h:12852
A normalized constraint, as defined in C++ [temp.constr.normal], is either an atomic constraint,...
Definition SemaConcept.h:82
Iterator range representation begin:end[:step].
Definition ExprOpenMP.h:278
This structure contains most locations needed for by an OMPVarListClause.
a linked list of methods with the same selector name but different signatures.
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition Overload.h:790
Describes how types, statements, expressions, and declarations should be printed.
SourceLocation CurrentPragmaLocation
Definition Sema.h:674
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
Definition Sema.h:8517
SourceRange InstantiationRange
The source range that covers the construct that cause the instantiation, e.g., the template-id that c...
Definition Sema.h:8654
enum clang::Sema::CodeSynthesisContext::SynthesisKind Kind
bool SavedInNonInstantiationSFINAEContext
Was the enclosing context a non-instantiation SFINAE context?
Definition Sema.h:8615
const TemplateArgument * TemplateArgs
The list of template arguments we are substituting, if they are not part of the entity.
Definition Sema.h:8630
sema::TemplateDeductionInfo * DeductionInfo
The template deduction info object associated with the substitution or checking of explicit or deduce...
Definition Sema.h:8649
ArrayRef< TemplateArgument > template_arguments() const
Definition Sema.h:8642
NamedDecl * Template
The template (or partial specialization) in which we are performing the instantiation,...
Definition Sema.h:8626
SourceLocation PointOfInstantiation
The point of instantiation or synthesis within the source code.
Definition Sema.h:8618
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition Sema.h:8636
SynthesisKind
The kind of template instantiation we are performing.
Definition Sema.h:8519
@ MarkingClassDllexported
We are marking a class as __dllexport.
Definition Sema.h:8605
@ DefaultTemplateArgumentInstantiation
We are instantiating a default argument for a template parameter.
Definition Sema.h:8529
@ ExplicitTemplateArgumentSubstitution
We are substituting explicit template arguments provided for a function template.
Definition Sema.h:8538
@ DefaultTemplateArgumentChecking
We are checking the validity of a default template argument that has been used when naming a template...
Definition Sema.h:8554
@ InitializingStructuredBinding
We are initializing a structured binding.
Definition Sema.h:8602
@ ExceptionSpecInstantiation
We are instantiating the exception specification for a function template which was deferred until it ...
Definition Sema.h:8562
@ NestedRequirementConstraintsCheck
We are checking the satisfaction of a nested requirement of a requires expression.
Definition Sema.h:8569
@ DefiningSynthesizedFunction
We are defining a synthesized function (such as a defaulted special member).
Definition Sema.h:8580
@ Memoization
Added for Template instantiation observation.
Definition Sema.h:8611
@ DeducedTemplateArgumentSubstitution
We are substituting template argument determined as part of template argument deduction for either a ...
Definition Sema.h:8545
@ PriorTemplateArgumentSubstitution
We are substituting prior template arguments into a new template parameter.
Definition Sema.h:8550
@ ExceptionSpecEvaluation
We are computing the exception specification for a defaulted special member function.
Definition Sema.h:8558
@ TemplateInstantiation
We are instantiating a template declaration.
Definition Sema.h:8522
@ DeclaringSpecialMember
We are declaring an implicit special member function.
Definition Sema.h:8572
@ DeclaringImplicitEqualityComparison
We are declaring an implicit 'operator==' for a defaulted 'operator<=>'.
Definition Sema.h:8576
@ DefaultFunctionArgumentInstantiation
We are instantiating a default argument for a function.
Definition Sema.h:8534
@ RewritingOperatorAsSpaceship
We are rewriting a comparison operator in terms of an operator<=>.
Definition Sema.h:8599
@ RequirementInstantiation
We are instantiating a requirement of a requires expression.
Definition Sema.h:8565
CXXSpecialMember SpecialMember
The special member being declared or defined.
Definition Sema.h:8639
Decl * Entity
The entity that is being synthesized.
Definition Sema.h:8621
bool isInstantiationRecord() const
Determines whether this template is an actual instantiation that should be counted toward the maximum...
Data structure used to record current or nested expression evaluation contexts.
Definition Sema.h:1225
SmallVector< CXXBindTemporaryExpr *, 8 > DelayedDecltypeBinds
If we are processing a decltype type, a set of temporary binding expressions for which we have deferr...
Definition Sema.h:1257
SmallVector< Expr *, 2 > VolatileAssignmentLHSs
Expressions appearing as the LHS of a volatile assignment in this context.
Definition Sema.h:1264
llvm::SmallPtrSet< const Expr *, 8 > PossibleDerefs
Definition Sema.h:1259
Decl * ManglingContextDecl
The declaration that provides context for lambda expressions and block literals if the normal declara...
Definition Sema.h:1249
SmallVector< CallExpr *, 8 > DelayedDecltypeCalls
If we are processing a decltype type, a set of call expressions for which we have deferred checking t...
Definition Sema.h:1253
llvm::SmallPtrSet< DeclRefExpr *, 4 > ReferenceToConsteval
Set of DeclRefExprs referencing a consteval function when used in a context not already known to be i...
Definition Sema.h:1271
llvm::SmallVector< ImmediateInvocationCandidate, 4 > ImmediateInvocationCandidates
Set of candidates for starting an immediate invocation.
Definition Sema.h:1267
enum clang::Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
Definition Sema.h:1244
ExpressionKind
Describes whether we are in an expression constext which we have to handle differently.
Definition Sema.h:1275
CleanupInfo ParentCleanup
Whether the enclosing context needed a cleanup.
Definition Sema.h:1230
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
Definition Sema.h:1238
ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, CleanupInfo ParentCleanup, Decl *ManglingContextDecl, ExpressionKind ExprContext)
Definition Sema.h:1279
ExpressionEvaluationContext Context
The expression evaluation context.
Definition Sema.h:1227
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Definition Sema.h:1234
A pair of a canonical FunctionDecl and a SourceLocation.
Definition Sema.h:11891
CanonicalDeclPtr< FunctionDecl > FD
Definition Sema.h:11892
An RAII helper that pops function a function scope on exit.
Definition Sema.h:4600
A stack object to be created when performing template instantiation.
Definition Sema.h:8779
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
Definition Sema.h:8918
InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, Decl *Entity, SourceRange InstantiationRange=SourceRange())
Note that we are instantiating a class template, function template, variable template,...
void Clear()
Note that we have finished instantiating this template.
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
Definition Sema.h:8922
LocalInstantiationScope * Scope
Definition Sema.h:9293
LateInstantiatedAttribute(const Attr *A, LocalInstantiationScope *S, Decl *D)
Definition Sema.h:9296
Keeps information about an identifier in a nested-name-spec.
Definition Sema.h:6374
IdentifierInfo * Identifier
The identifier preceding the '::'.
Definition Sema.h:6380
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, ParsedType ObjectType=ParsedType())
Creates info object for the most typical case.
Definition Sema.h:6389
SourceLocation IdentifierLoc
The location of the identifier.
Definition Sema.h:6383
SourceLocation CCLoc
The location of the '::'.
Definition Sema.h:6386
ParsedType ObjectType
The type of the object, if we're parsing nested-name-specifier in a member access expression.
Definition Sema.h:6377
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, QualType ObjectType)
Definition Sema.h:6395
Data structure for iterator expression.
Definition Sema.h:5245
OMPIteratorExpr::IteratorRange Range
Definition Sema.h:5249
SourceLocation DeclIdentLoc
Definition Sema.h:5247
IdentifierInfo * DeclIdent
Definition Sema.h:5246
SourceLocation AssignLoc
Definition Sema.h:5250
SourceLocation ColonLoc
Definition Sema.h:5251
SourceLocation SecColonLoc
Definition Sema.h:5252
IdentifierInfo * Name
Definition Sema.h:9627
ParsedAttributesView ArgAttrs
ArgAttrs - Attribute list for this argument.
Definition Sema.h:9635
ObjCDeclSpec DeclSpec
Definition Sema.h:9632
SourceLocation NameLoc
Definition Sema.h:9628
SourceLocation LocStart
Definition Sema.h:5446
union clang::Sema::OffsetOfComponent::@232 U
IdentifierInfo * IdentInfo
Definition Sema.h:5449
brief A function argument from which we performed template argument
Definition Sema.h:8356
OriginalCallArg(QualType OriginalParamType, bool DecomposedParam, unsigned ArgIdx, QualType OriginalArgType)
Definition Sema.h:8357
This an attribute introduced by #pragma clang attribute.
Definition Sema.h:720
SmallVector< attr::SubjectMatchRule, 4 > MatchRules
Definition Sema.h:723
A push'd group of PragmaAttributeEntries.
Definition Sema.h:728
SourceLocation Loc
The location of the push attribute.
Definition Sema.h:730
SmallVector< PragmaAttributeEntry, 2 > Entries
Definition Sema.h:733
const IdentifierInfo * Namespace
The namespace of this push group.
Definition Sema.h:732
SourceLocation PragmaLocation
Definition Sema.h:457
Slot(llvm::StringRef StackSlotLabel, ValueType Value, SourceLocation PragmaLocation, SourceLocation PragmaPushLocation)
Definition Sema.h:585
llvm::StringRef StackSlotLabel
Definition Sema.h:581
SourceLocation PragmaLocation
Definition Sema.h:583
SourceLocation PragmaPushLocation
Definition Sema.h:584
ValueType CurrentValue
Definition Sema.h:655
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
Definition Sema.h:641
bool hasValue() const
Definition Sema.h:651
SmallVector< Slot, 2 > Stack
Definition Sema.h:653
ValueType DefaultValue
Definition Sema.h:654
SourceLocation CurrentPragmaLocation
Definition Sema.h:656
PragmaStack(const ValueType &Default)
Definition Sema.h:648
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition Sema.h:592
ReferenceConversions
The conversions that would be performed on an lvalue of type T2 when binding a reference of type T1 t...
Definition Sema.h:11612
NamedDecl * Previous
Definition Sema.h:2303
Abstract class used to diagnose incomplete types.
Definition Sema.h:2010
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull)
Definition Sema.h:12548
unsigned LayoutCompatible
If true, Type should be compared with other expression's types for layout-compatibility.
Definition Sema.h:12557
Data for list of allocators.
Definition Sema.h:11160
Expr * Allocator
Allocator.
Definition Sema.h:11162
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
Definition Sema.h:11166
Expr * AllocatorTraits
Allocator traits.
Definition Sema.h:11164
Information about a template-id annotation token.
static bool isEqual(const FunctionDeclAndLoc &LHS, const FunctionDeclAndLoc &RHS)
Definition Sema.h:12883
static unsigned getHashValue(const FunctionDeclAndLoc &FDL)
Definition Sema.h:12878